diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index af17a16..ec58541 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -899,11 +899,15 @@ class Client(object): if layer not in layers: print("invalid layer name, choices are: ", ', '.join(layers)) sys.exit(1) + if filename.endswith('.vtt'): + load = ox.vtt.load + else: + load = ox.srt.load annotations = [{ 'in': s['in'], 'out': s['out'], 'value': s['value'].replace('\n', '
\n') if layer == 'subtitles' else s['value'], - } for s in ox.srt.load(filename)] + } for s in load(filename)] r = self.api.addAnnotations({ 'item': item, 'layer': layer, diff --git a/pandora_client/utils.py b/pandora_client/utils.py index 9ee11bf..9a2c0ff 100644 --- a/pandora_client/utils.py +++ b/pandora_client/utils.py @@ -42,7 +42,7 @@ def avinfo(filename, cached=True): dar = AspectRatio(info['video'][0]['width'], info['video'][0]['height']) info['video'][0]['display_aspect_ratio'] = dar.ratio del info['path'] - if os.path.splitext(filename)[-1] in ('.srt', '.sub', '.idx', '.rar') and 'error' in info: + if os.path.splitext(filename)[-1] in ('.vtt', '.srt', '.sub', '.idx', '.rar') and 'error' in info: del info['error'] if 'code' in info and info['code'] == 'badfile': del info['code']