mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-24 18:05:07 +00:00
fix(webvtt): don't shorten cues when splicing boundary duplicates
This commit is contained in:
@@ -62,8 +62,10 @@ def merge_segmented_webvtt(vtt_raw: str, segment_durations: Optional[list[int]]
|
||||
|
||||
normalized = "\n".join(line.strip() for line in payload)
|
||||
if prev is not None and _timestamp_ms(start) - prev_end_ms <= 1 and normalized == prev[4]:
|
||||
prev[1] = end # splice: extend the kept cue, drop the duplicate
|
||||
prev_end_ms = _timestamp_ms(end)
|
||||
end_ms = _timestamp_ms(end)
|
||||
if end_ms > prev_end_ms: # splice: extend only, never shorten the kept cue
|
||||
prev[1] = end
|
||||
prev_end_ms = end_ms
|
||||
continue
|
||||
|
||||
prev = [start, end, settings, "\n".join(payload), normalized]
|
||||
|
||||
Reference in New Issue
Block a user