get_srt
This commit is contained in:
parent
5103e8f81b
commit
b4c4a2fabb
2 changed files with 12 additions and 6 deletions
13
render.py
13
render.py
|
|
@ -538,6 +538,14 @@ def render_all(options):
|
|||
json.dump(_CACHE, fd)
|
||||
|
||||
|
||||
def get_srt(sub, offset=0):
|
||||
sdata = sub.json(keys=['in', 'out', 'value'])
|
||||
sdata['value'] = sdata['value'].replace('<br/>', '<br>').replace('<br>\n', '\n').replace('<br>', '\n')
|
||||
if offset:
|
||||
sdata["in"] += offset
|
||||
sdata["out"] += offset
|
||||
return sdata
|
||||
|
||||
def update_subtitles(options):
|
||||
import item.models
|
||||
|
||||
|
|
@ -563,10 +571,7 @@ def update_subtitles(options):
|
|||
vo = item.models.Item.objects.filter(data__icontains='2-Whispered', data__title__startswith=fragment_id + '_').first()
|
||||
if vo:
|
||||
for sub in vo.annotations.filter(layer="subtitles").exclude(value="").order_by("start"):
|
||||
sdata = sub.json(keys=['in', 'out', 'value'])
|
||||
sdata['value'] = sdata['value'].replace('<br/>', '<br>').replace('<br>\n', '\n').replace('<br>', '\n')
|
||||
sdata["in"] += offset
|
||||
sdata["out"] += offset
|
||||
sdata = get_srt(sub, offset)
|
||||
subs.append(sdata)
|
||||
offset += clip['duration']
|
||||
path = folder / "front.srt"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue