Skip to content

Commit

Permalink
Fix dmunozv04#119 by combining segments 1 second apart better
Browse files Browse the repository at this point in the history
  • Loading branch information
bertybuttface committed Jan 27, 2024
1 parent a75dd83 commit 24aedf7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/iSponsorBlockTV/api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,12 @@ def process_segments(response):
segment_before_start = segments[-1]["start"]
segment_before_UUID = segments[-1]["UUID"]

except Exception:
except IndexError:
segment_before_end = -10
if (
segment_dict["start"] - segment_before_end < 1
): # Less than 1 second apart, combine them and skip them together
segment_dict["end"] = max(segment_dict["end"], segment_before_end)
segment_dict["start"] = segment_before_start
segment_dict["UUID"].extend(segment_before_UUID)
segments.pop()
Expand Down

0 comments on commit 24aedf7

Please sign in to comment.