siku2 / script.service.sponsorblock

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

Addon tries to run when any media is played, even local files, and throws an error #26

Closed dziban303 closed 3 years ago

dziban303 commented 3 years ago

I was surprised to see that, when playing local content, the SponsorBlock addon attempts to run. This obviously fails, and an error is thrown, which is displayed full-screen by the Log Viewer addon.

image

It seems strange that the SponsorBlock addon would attempt to run when any content is played. It should be possible—should it not?—to only initiate the addon when the media is a Youtube video.

siku2 commented 3 years ago

Unfortunately, there are other add-ons that can play youtube videos. The add-on does handle the main YouTube add on explicitly, but it tries to accommodate other add-ons by looking for a YouTube thumbnail url.

What you encountered here is definitely a bug though. It should run for every video, but it shouldn't crash.

siku2 commented 3 years ago

If you can, please attach the full error so I can fix the error.

dziban303 commented 3 years ago

Sure. Since there may be other stuff in the log which is germane, here's the entire process of playing a local video file for a few seconds.

2021-05-27 09:32:12.972 T:9616  NOTICE: VideoPlayer::OpenFile: E:\Video\TVShows\<a local media file 🏴‍☠️>
2021-05-27 09:32:12.972 T:2820 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED
2021-05-27 09:32:12.972 T:2820  NOTICE: Creating InputStream
2021-05-27 09:32:13.021 T:2820  NOTICE: Creating Demuxer
2021-05-27 09:32:13.072 T:8392   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: argument of type 'NoneType' is not iterable
                                            Traceback (most recent call last):
                                              File "C:\Users\dziba\AppData\Roaming\Kodi\addons\script.service.sponsorblock\resources\lib\player_listener.py", line 118, in onPlayBackStarted
                                                video_id = youtube_api.get_video_id()
                                              File "C:\Users\dziba\AppData\Roaming\Kodi\addons\script.service.sponsorblock\resources\lib\youtube_api.py", line 162, in get_video_id
                                                return video_id_from_list_item(has_context)
                                              File "C:\Users\dziba\AppData\Roaming\Kodi\addons\script.service.sponsorblock\resources\lib\youtube_api.py", line 116, in video_id_from_list_item
                                                video_id = _video_id_from_art(art, has_context)
                                              File "C:\Users\dziba\AppData\Roaming\Kodi\addons\script.service.sponsorblock\resources\lib\youtube_api.py", line 55, in _video_id_from_art
                                                if DOMAIN_THUMBNAIL not in thumb_url.hostname:
                                            TypeError: argument of type 'NoneType' is not iterable
                                            -->End of Python script error report<--
2021-05-27 09:32:13.178 T:2820  NOTICE: Opening stream: 0 source: 256
2021-05-27 09:32:13.178 T:2820  NOTICE: Creating video codec with codec id: 12
2021-05-27 09:32:13.178 T:2820  NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: MPEG-4 part 2
2021-05-27 09:32:13.179 T:2820  NOTICE: Creating video thread
2021-05-27 09:32:13.179 T:6056  NOTICE: running thread: video_thread
2021-05-27 09:32:13.179 T:2820  NOTICE: Opening stream: 1 source: 256
2021-05-27 09:32:13.179 T:2820  NOTICE: Finding audio codec for: 86019
2021-05-27 09:32:13.179 T:2820  NOTICE: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder ac3
2021-05-27 09:32:13.180 T:2820  NOTICE: Creating audio thread
2021-05-27 09:32:13.180 T:10788  NOTICE: running thread: CVideoPlayerAudio::Process()
2021-05-27 09:32:13.180 T:2820  NOTICE: Opening stream: 0 source: 1024
2021-05-27 09:32:13.247 T:6056  NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: MPEG-4 part 2
2021-05-27 09:32:13.248 T:10788  NOTICE: Creating audio stream (codec id: 86019, channels: 2, sample rate: 48000, no pass-through)
2021-05-27 09:32:13.552 T:9616 WARNING: Skin has invalid include: Animation_DialogPopupOpenClose
2021-05-27 09:32:13.737 T:7948   ERROR: CCurlFile::FillBuffer - Failed: Timeout was reached(28)
2021-05-27 09:32:13.987 T:6056  NOTICE: CDVDVideoCodecFFmpeg::CDropControl: calculated diff time: 40000
2021-05-27 09:32:24.102 T:6056 WARNING: CRenderManager::WaitForBuffer - timeout waiting for buffer
2021-05-27 09:32:29.468 T:9616 WARNING: Previous line repeats 10 times.
2021-05-27 09:32:29.468 T:9616  NOTICE: CVideoPlayer::CloseFile()
siku2 commented 3 years ago

Fixed in v0.3.1