siku2 / script.service.sponsorblock

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

Segments in local music are skipped randomly #17

Closed Ben-Kaniobi closed 3 years ago

Ben-Kaniobi commented 3 years ago

I frequently use Kodi for listening to my local music collection (mp3 files added to the library with the Local information only information provider).

Once in a while a part of a song is skipped by SponsorBlock. It does not happen for every song, but it definitely happened more than once and for different songs.

In the SponsorBlock settings I only have Sponsor and Non-Music Section active.

SponsorBlock should only check YouTube and YTMusic content, not other media like local Music and Movies etc.

I could provide an mp3 file for reproducing the issue if it's not something obvious in the code &rarr let me know. (However I'm not sure about the legal aspect of that...)

siku2 commented 3 years ago

That's really weird... Is is possible that your music uses YouTube thumbnails? It's also very possible that Kodi is doing something funny here. There are many issues where Kodi straight up reports out of date information. It would be great if you could describe the steps that usually lead to this situation (if there are steps that reliably reproduce it) and even more important, the Kodi logs - preferably with debug level.

macearl commented 3 years ago

I'm not at my kodi device right now.

But I have experienced something similar as well yesterday. I was watching a local mp4 file (a recording of a TV show) which was not added to any library (the directory is set to "contains none" ) and it skipped part of it as a sponsor segment.

I'll try and reproduce this tonight, is there anything, besides debug logging of course, which I should enable beforehand?

(I also experienced some major problems while watching actual YouTube videos as well but I have to debug that further and probably open a separate issue)

macearl commented 3 years ago

I was now able to reproduce this with my Kodi Installation.

  1. Start a youtube video (here it does not skip any sponsor segments for me) and stop the playback after a while
  2. Now start playback of a local file which is longer than the youtube video, or at least longer than the sponsor time spans
  3. during the start of playback sponsorblock tries to get the youtube id and fails
  4. when the time stamp of a sponsor segment of the youtube video from 1 is reached it will skip the same segment in the local file.

I have condensed the Debug log down quite a quit to hopefully all the relevant sections, it can be found here: https://sebsauvage.net/paste/?75657fe2b6cdddfa#/0j6W+dEAjqGlVPiTs/016Svj980dp3CjFv8RITmSFw=

siku2 commented 3 years ago

oh this is superb! The error in the log is interesting but not necessarily a big issue. I simply hadn't considered file paths without a hostname (silly me). This should be fixed now.

Much more interesting is the fact that my little checkpoint listener didn't notice that the previous video had stopped playing. I did some digging and apparently Kodi doesn't have a catch-all "video has stopped playing" event. Instead, there are different events (ended, stopped, error'd) which need to be handled individually. As you might expect, I wasn't aware of that. The checkpoint listener ignored you stopping the video, kept running, and jumped into action when the time was (supposed to be) right. Simple solution; I just implemented all the other event handlers and that should hopefully fix it.

Please let me know if this has fixed the issue.

macearl commented 3 years ago

That seems to have fixed that particular problem, at least for me.

For the other "major" problem I encountered see the just created PR ;)

siku2 commented 3 years ago

I believe this issue has been solved now