From a2c93098086fbfc809abf645db5bfe20640c1ccb Mon Sep 17 00:00:00 2001 From: j Date: Tue, 28 Jul 2020 11:36:20 +0200 Subject: [PATCH 1/5] not all torrents have announce --- ox/torrent/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ox/torrent/__init__.py b/ox/torrent/__init__.py index 7818bc7..a250215 100644 --- a/ox/torrent/__init__.py +++ b/ox/torrent/__init__.py @@ -55,7 +55,8 @@ def get_torrent_info(data=None, file=None): tinfo[key] = metainfo[key] tinfo['size'] = file_length tinfo['hash'] = sha1(bencode(info)).hexdigest() - tinfo['announce'] = metainfo['announce'] + if 'announce' in metainfo: + tinfo['announce'] = metainfo['announce'] if file: tinfo['timestamp'] = os.stat(file).st_ctime return tinfo From 851204c619fc00f56b3e784e50eb525bd4a6b5be Mon Sep 17 00:00:00 2001 From: j Date: Thu, 15 Oct 2020 11:39:19 +0200 Subject: [PATCH 2/5] allow target="_blank" for href --- ox/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ox/html.py b/ox/html.py index bd59ace..73234ea 100644 --- a/ox/html.py +++ b/ox/html.py @@ -290,8 +290,10 @@ def sanitize_html(html, tags=None, global_attributes=[]): { 'name': 'a', 'required': ['href'], + 'optional': ['target'], 'validation': { - 'href': valid_url + 'href': valid_url, + 'target': '^_blank$', } }, {'name': 'br'}, From 2ebc6ffd3a5153d4308763e1547fd3153f59f98b Mon Sep 17 00:00:00 2001 From: j Date: Thu, 28 Jan 2021 12:56:11 +0100 Subject: [PATCH 3/5] use py3 tests --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 7c2bac9..284dcb7 100755 --- a/test.sh +++ b/test.sh @@ -1 +1 @@ -nosetests --with-doctest ox +nosetests3 --with-doctest ox From f7c7a6689b117de1405c830d133ad81cc1ee5677 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 19 Feb 2021 00:10:59 +0100 Subject: [PATCH 4/5] don't print status during upload --- ox/api.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ox/api.py b/ox/api.py index 159aec7..ec6f428 100644 --- a/ox/api.py +++ b/ox/api.py @@ -151,7 +151,7 @@ class API(object): fd.write(chunk) shutil.move(tmpname, filename) - def upload_chunks(self, url, filename, data=None): + def upload_chunks(self, url, filename, data=None, silent=False): form = MultiPartForm() if data: for key in data: @@ -188,26 +188,31 @@ class API(object): try: data = self._json_request(uploadUrl, form) except KeyboardInterrupt: - print("\ninterrupted by user.") + if not slient: + print("\ninterrupted by user.") sys.exit(1) except: - print("uploading chunk failed, will try again in 5 seconds\r", end='') + if not slient: + print("uploading chunk failed, will try again in 5 seconds\r", end='') sys.stdout.flush() data = {'result': -1} time.sleep(5) if data and 'status' in data: if data['status']['code'] == 403: - print("login required") + if not slient: + print("login required") return False if data['status']['code'] != 200: - print("request returned error, will try again in 5 seconds") + if not slient: + print("request returned error, will try again in 5 seconds") if self.DEBUG: print(data) time.sleep(5) if data and data.get('result') == 1: done += len(chunk) if data.get('offset') not in (None, done): - print('server offset out of sync, continue from', data['offset']) + if not slient: + print('server offset out of sync, continue from', data['offset']) done = data['offset'] f.seek(done) chunk = f.read(CHUNK_SIZE) From 7e72cfd163d9fc868f79f0ae928fc8f926106926 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 23 Feb 2021 09:09:35 +0100 Subject: [PATCH 5/5] support dat --- ox/api.py | 1 + ox/file.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ox/api.py b/ox/api.py index ec6f428..b784788 100644 --- a/ox/api.py +++ b/ox/api.py @@ -151,6 +151,7 @@ class API(object): fd.write(chunk) shutil.move(tmpname, filename) + def upload_chunks(self, url, filename, data=None, silent=False): form = MultiPartForm() if data: diff --git a/ox/file.py b/ox/file.py index ec9da4b..f12aee7 100644 --- a/ox/file.py +++ b/ox/file.py @@ -32,7 +32,8 @@ EXTENSIONS = { 'avi', 'divx', 'dv', 'flv', 'm2t', 'm2ts', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mts', 'ogm', 'ogv', 'rm', 'rmvb', 'vob', 'webm', 'wmv', 'asf', 'mod', 'tod', # http://en.wikipedia.org/wiki/MOD_and_TOD - 'mxf', 'ts' + 'mxf', 'ts', + 'dat', # VOD files ], }