diff --git a/ox/api.py b/ox/api.py index b784788..159aec7 100644 --- a/ox/api.py +++ b/ox/api.py @@ -151,8 +151,7 @@ class API(object): fd.write(chunk) shutil.move(tmpname, filename) - - def upload_chunks(self, url, filename, data=None, silent=False): + def upload_chunks(self, url, filename, data=None): form = MultiPartForm() if data: for key in data: @@ -189,31 +188,26 @@ class API(object): try: data = self._json_request(uploadUrl, form) except KeyboardInterrupt: - if not slient: - print("\ninterrupted by user.") + print("\ninterrupted by user.") sys.exit(1) except: - if not slient: - print("uploading chunk failed, will try again in 5 seconds\r", end='') + 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: - if not slient: - print("login required") + print("login required") return False if data['status']['code'] != 200: - if not slient: - print("request returned error, will try again in 5 seconds") + 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): - if not slient: - print('server offset out of sync, continue from', data['offset']) + print('server offset out of sync, continue from', data['offset']) done = data['offset'] f.seek(done) chunk = f.read(CHUNK_SIZE) diff --git a/ox/file.py b/ox/file.py index f12aee7..ec9da4b 100644 --- a/ox/file.py +++ b/ox/file.py @@ -32,8 +32,7 @@ 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', - 'dat', # VOD files + 'mxf', 'ts' ], } diff --git a/ox/html.py b/ox/html.py index 73234ea..bd59ace 100644 --- a/ox/html.py +++ b/ox/html.py @@ -290,10 +290,8 @@ def sanitize_html(html, tags=None, global_attributes=[]): { 'name': 'a', 'required': ['href'], - 'optional': ['target'], 'validation': { - 'href': valid_url, - 'target': '^_blank$', + 'href': valid_url } }, {'name': 'br'}, diff --git a/ox/torrent/__init__.py b/ox/torrent/__init__.py index a250215..7818bc7 100644 --- a/ox/torrent/__init__.py +++ b/ox/torrent/__init__.py @@ -55,8 +55,7 @@ def get_torrent_info(data=None, file=None): tinfo[key] = metainfo[key] tinfo['size'] = file_length tinfo['hash'] = sha1(bencode(info)).hexdigest() - if 'announce' in metainfo: - tinfo['announce'] = metainfo['announce'] + tinfo['announce'] = metainfo['announce'] if file: tinfo['timestamp'] = os.stat(file).st_ctime return tinfo diff --git a/test.sh b/test.sh index 284dcb7..7c2bac9 100755 --- a/test.sh +++ b/test.sh @@ -1 +1 @@ -nosetests3 --with-doctest ox +nosetests --with-doctest ox