fix update_subtitles
This commit is contained in:
parent
3782ca6721
commit
438108a8f9
1 changed files with 7 additions and 7 deletions
14
render.py
14
render.py
|
@ -611,6 +611,13 @@ def update_subtitles(options):
|
||||||
lang = options["lang"]
|
lang = options["lang"]
|
||||||
if lang and "," in lang:
|
if lang and "," in lang:
|
||||||
lang = lang.split(',')
|
lang = lang.split(',')
|
||||||
|
if isinstance(lang, list):
|
||||||
|
tlang = lang[1:]
|
||||||
|
lang = lang[0]
|
||||||
|
else:
|
||||||
|
tlang = None
|
||||||
|
if lang == "en":
|
||||||
|
lang = None
|
||||||
|
|
||||||
_cache = os.path.join(prefix, "cache.json")
|
_cache = os.path.join(prefix, "cache.json")
|
||||||
if os.path.exists(_cache):
|
if os.path.exists(_cache):
|
||||||
|
@ -630,13 +637,6 @@ def update_subtitles(options):
|
||||||
vo = item.models.Item.objects.filter(data__batch__icontains=batch, data__title__startswith=fragment_id + '_').first()
|
vo = item.models.Item.objects.filter(data__batch__icontains=batch, data__title__startswith=fragment_id + '_').first()
|
||||||
if vo:
|
if vo:
|
||||||
#print("%s => %s %s" % (clip['src'], vo, vo.get('batch')))
|
#print("%s => %s %s" % (clip['src'], vo, vo.get('batch')))
|
||||||
if isinstance(lang, list):
|
|
||||||
tlang = lang[1:]
|
|
||||||
lang = lang[0]
|
|
||||||
else:
|
|
||||||
tlang = None
|
|
||||||
if lang == "en":
|
|
||||||
lang = None
|
|
||||||
for sub in vo.annotations.filter(layer="subtitles").filter(languages=lang).exclude(value="").order_by("start"):
|
for sub in vo.annotations.filter(layer="subtitles").filter(languages=lang).exclude(value="").order_by("start"):
|
||||||
sdata = get_srt(sub, offset, tlang)
|
sdata = get_srt(sub, offset, tlang)
|
||||||
subs.append(sdata)
|
subs.append(sdata)
|
||||||
|
|
Loading…
Reference in a new issue