diff --git a/ox/api.py b/ox/api.py index 159aec7..b784788 100644 --- a/ox/api.py +++ b/ox/api.py @@ -151,7 +151,8 @@ 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 +189,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) 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 ], }