mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2025-01-08 14:17:54 +01:00
Reflect merged cues in indexes
This commit is contained in:
parent
cbb5155060
commit
405947c32e
@ -2833,6 +2833,7 @@ def dfxp2srt(dfxp_data):
|
|||||||
|
|
||||||
last_begin_time = None
|
last_begin_time = None
|
||||||
last_end_time = None
|
last_end_time = None
|
||||||
|
index_offset = 0
|
||||||
|
|
||||||
for para, index in zip(paras, itertools.count(1)):
|
for para, index in zip(paras, itertools.count(1)):
|
||||||
begin_time = parse_dfxp_time_expr(para.attrib.get('begin'))
|
begin_time = parse_dfxp_time_expr(para.attrib.get('begin'))
|
||||||
@ -2846,10 +2847,10 @@ def dfxp2srt(dfxp_data):
|
|||||||
end_time = begin_time + dur
|
end_time = begin_time + dur
|
||||||
|
|
||||||
if begin_time == last_begin_time and end_time == last_end_time:
|
if begin_time == last_begin_time and end_time == last_end_time:
|
||||||
|
index_offset += 1
|
||||||
out.append('%s\n' % (parse_node(para)))
|
out.append('%s\n' % (parse_node(para)))
|
||||||
else:
|
else:
|
||||||
out.append('\n%d\n%s --> %s\n%s\n' % (
|
index - index_offset,
|
||||||
index,
|
|
||||||
srt_subtitles_timecode(begin_time),
|
srt_subtitles_timecode(begin_time),
|
||||||
srt_subtitles_timecode(end_time),
|
srt_subtitles_timecode(end_time),
|
||||||
parse_node(para)))
|
parse_node(para)))
|
||||||
|
Loading…
Reference in New Issue
Block a user