From 8e8348cca35f37e68ee8e8093de444f914d5de98 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 17 May 2017 10:15:28 +0000 Subject: [PATCH] update subtitles --- encode.py | 5 +++++ subtitles.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/encode.py b/encode.py index 7378823..5774afe 100755 --- a/encode.py +++ b/encode.py @@ -35,6 +35,7 @@ def is_new(xml, mp4): return vtime < xtime def encode(xml, force=False): + item_json = xml.relace('.xml', '.json') audio_xml = xml.replace('.xml', '.audio.xml') vocals_xml = xml.replace('.xml', '.vocals.xml') mp4 = xml.replace('.xml', '.mp4') @@ -121,6 +122,10 @@ def encode(xml, force=False): subprocess.call(cmd) shutil.move(mp4, public_mp4) shutil.move(mp4_480p, public_mp4_480p) + cms = [ + './subtitles.py', item_json + ] + subprocess.call(cmd) def encode_all(): for xml in sorted(glob('output/*/*.xml')): diff --git a/subtitles.py b/subtitles.py index 256be89..6020550 100644 --- a/subtitles.py +++ b/subtitles.py @@ -97,7 +97,11 @@ if __name__ == '__main__': with open('subtitles.json', 'w') as fd: json.dump(items, fd, indent=4, ensure_ascii=False) - for item_json in glob('output/*/*.json'): + if len(sys.argv) > 1: + files = sys.argv[1:] + else: + files = glob('output/*/*.json') + for item_json in files: prefix = 'public/' + item_json.split('/')[-1][0].lower() + item_json.split('/')[-2] + '.1080p.' output_json = prefix + 'json' output_srt = prefix + 'srt'