siku2 / script.service.sponsorblock

Kodi add-on for SponsorBlock
MIT License
124 stars 14 forks source link

Segment at the very beginning not skipped #38

Open ape364 opened 1 year ago

ape364 commented 1 year ago

Hi, when I share link to the video https://www.youtube.com/watch?v=EFaqj5JYktU from Yatse plugin does not skip ad (segment 0:00.000 to 0:27.262).

Here are the logs https://gist.github.com/ape364/f0a644d8ad1aef39ff2f6b3951df92ac

I don't see any exceptions from SponsorBlock plugin.

siku2 commented 1 year ago

The relevant lines are these:

2022-12-03 17:54:54.941 T:808     DEBUG <general>: [script.service.sponsorblock] player_listener: got segments [SponsorSegment(uuid='9054431c7a491b1178a98461c00b0b65c147fd7990154109caba200b477154606', category='sponsor', start=0, end=27.262)]
2022-12-03 17:54:54.941 T:808     DEBUG <general>: [script.service.sponsorblock] player_listener: searching for next segment after 0.09

The addon is only ready at 0.09 so it doesn't consider the segment starting at 0.00. For anyone looking to fix this, the relevant code is here:

https://github.com/siku2/script.service.sponsorblock/blob/e9ba63b5263129ce1d34929469e49d21d2cac591/resources/lib/player_listener.py#L150-L159

One approach I would consider is to pass an additional flag to this function when called from the onPlaybackStarted callback here:

https://github.com/siku2/script.service.sponsorblock/blob/e9ba63b5263129ce1d34929469e49d21d2cac591/resources/lib/player_listener.py#L137-L138

So that if called from onPlaybackStarted, the _select_next_checkpoint is allowed to select a segment that's already started.

ape364 commented 1 year ago

@siku2 please check #41 thanks!

ape364 commented 1 year ago

@siku2 could you release these changes? Thanks!

ape364 commented 1 year ago

Bump :)