skip subtilte events without duration, #196

This commit is contained in:
simon 2022-04-14 15:53:10 +07:00
parent 5f90d21234
commit a8a7edb93e
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 5 additions and 0 deletions

View File

@ -170,6 +170,11 @@ class SubtitleParser:
self.all_cues = []
for idx, event in enumerate(all_events):
if "dDurationMs" not in event:
# some events won't have a duration
print(f"failed to parse event without duration: {event}")
continue
cue = {
"start": self._ms_conv(event["tStartMs"]),
"end": self._ms_conv(event["tStartMs"] + event["dDurationMs"]),