Skip to content

Commit

Permalink
Fix subtitle delay function (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister committed Jul 23, 2023
1 parent 464522a commit ff46259
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion resources/lib/vtmgo/vtmgostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ def _delay_webvtt_timing(match, ad_breaks):
for timestamp in match.groups():
hours, minutes, seconds, millis = (int(x) for x in [timestamp[:-10], timestamp[-9:-7], timestamp[-6:-4], timestamp[-3:]])
sub_timings.append(timedelta(hours=hours, minutes=minutes, seconds=seconds, milliseconds=millis))
original_start_time = sub_timings[0]
for ad_break in ad_breaks:
# time format: seconds.fraction or seconds
ad_break_start = timedelta(milliseconds=ad_break.get('start') * 1000)
ad_break_duration = timedelta(milliseconds=ad_break.get('duration') * 1000)
if ad_break_start <= sub_timings[0]:
if ad_break_start <= original_start_time:
for idx, item in enumerate(sub_timings):
sub_timings[idx] += ad_break_duration
for idx, item in enumerate(sub_timings):
Expand Down

0 comments on commit ff46259

Please sign in to comment.