update subtitles
This commit is contained in:
parent
a407dfd1b5
commit
8e8348cca3
2 changed files with 10 additions and 1 deletions
|
@ -35,6 +35,7 @@ def is_new(xml, mp4):
|
||||||
return vtime < xtime
|
return vtime < xtime
|
||||||
|
|
||||||
def encode(xml, force=False):
|
def encode(xml, force=False):
|
||||||
|
item_json = xml.relace('.xml', '.json')
|
||||||
audio_xml = xml.replace('.xml', '.audio.xml')
|
audio_xml = xml.replace('.xml', '.audio.xml')
|
||||||
vocals_xml = xml.replace('.xml', '.vocals.xml')
|
vocals_xml = xml.replace('.xml', '.vocals.xml')
|
||||||
mp4 = xml.replace('.xml', '.mp4')
|
mp4 = xml.replace('.xml', '.mp4')
|
||||||
|
@ -121,6 +122,10 @@ def encode(xml, force=False):
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
shutil.move(mp4, public_mp4)
|
shutil.move(mp4, public_mp4)
|
||||||
shutil.move(mp4_480p, public_mp4_480p)
|
shutil.move(mp4_480p, public_mp4_480p)
|
||||||
|
cms = [
|
||||||
|
'./subtitles.py', item_json
|
||||||
|
]
|
||||||
|
subprocess.call(cmd)
|
||||||
|
|
||||||
def encode_all():
|
def encode_all():
|
||||||
for xml in sorted(glob('output/*/*.xml')):
|
for xml in sorted(glob('output/*/*.xml')):
|
||||||
|
|
|
@ -97,7 +97,11 @@ if __name__ == '__main__':
|
||||||
with open('subtitles.json', 'w') as fd:
|
with open('subtitles.json', 'w') as fd:
|
||||||
json.dump(items, fd, indent=4, ensure_ascii=False)
|
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.'
|
prefix = 'public/' + item_json.split('/')[-1][0].lower() + item_json.split('/')[-2] + '.1080p.'
|
||||||
output_json = prefix + 'json'
|
output_json = prefix + 'json'
|
||||||
output_srt = prefix + 'srt'
|
output_srt = prefix + 'srt'
|
||||||
|
|
Loading…
Reference in a new issue