From 405947c32e6975c854e28e69836393b275e88539 Mon Sep 17 00:00:00 2001 From: Niklas Date: Tue, 2 Oct 2018 19:10:33 +0200 Subject: [PATCH] Reflect merged cues in indexes --- youtube_dl/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 17ea7bc09..c9586e9b1 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2833,6 +2833,7 @@ def dfxp2srt(dfxp_data): last_begin_time = None last_end_time = None + index_offset = 0 for para, index in zip(paras, itertools.count(1)): begin_time = parse_dfxp_time_expr(para.attrib.get('begin')) @@ -2846,10 +2847,10 @@ def dfxp2srt(dfxp_data): end_time = begin_time + dur if begin_time == last_begin_time and end_time == last_end_time: + index_offset += 1 out.append('%s\n' % (parse_node(para))) else: - out.append('\n%d\n%s --> %s\n%s\n' % ( - index, + index - index_offset, srt_subtitles_timecode(begin_time), srt_subtitles_timecode(end_time), parse_node(para)))