mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
fix retiming issue for auto subtitles
This commit is contained in:
parent
d3e9646fb6
commit
aff0cfb794
@ -178,6 +178,14 @@ class SubtitleParser:
|
|||||||
if not text.strip():
|
if not text.strip():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if flatten:
|
||||||
|
# fix overlapping retiming issue
|
||||||
|
last_end = flatten[-1]["tStartMs"] + flatten[-1]["dDurationMs"]
|
||||||
|
if event["tStartMs"] < last_end:
|
||||||
|
joined = flatten[-1]["segs"][0]["utf8"] + "\n" + text
|
||||||
|
flatten[-1]["segs"][0]["utf8"] = joined
|
||||||
|
continue
|
||||||
|
|
||||||
event.update({"segs": [{"utf8": text}]})
|
event.update({"segs": [{"utf8": text}]})
|
||||||
flatten.append(event)
|
flatten.append(event)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user