smirgol / plugin.video.crunchyroll

Watch videos from the anime platform Crunchyroll.com on Kodi
GNU Affero General Public License v3.0
51 stars 10 forks source link

Can we get a proper error message for TOO_MANY_ACTIVE_STREAMS? #55

Closed Yavos closed 7 months ago

Yavos commented 8 months ago

After failing a few times (probably due to server side errors) in getting the video data crunchyroll returned a too many streams error but in Kodi it just said "failed to play video". This might not happen often and isn't that helpful for this specific case but others who share their accounts might run into this as well. For them it would be a quite useful information, I think.

Here's the relevant part of my log:

2024-03-21 06:48:48.481 T:26872    info <general>: [PLUGIN] Crunchyroll: add_listables: Starting to retrieve data async
2024-03-21 06:48:49.088 T:26872    info <general>: [PLUGIN] Crunchyroll: add_listables: Finished to retrieve data async
2024-03-21 06:49:08.285 T:21268    info <general>: [PLUGIN] Crunchyroll: VideoStream: Starting to retrieve data async
2024-03-21 06:49:08.286 T:21268    info <general>: [PLUGIN] Crunchyroll: URL: https://cr-play-service.prd.crunchyrollsvc.com/v1/G8WUN10Q3/android/phone/play
2024-03-21 06:49:08.417 T:21268    info <general>: [PLUGIN] Crunchyroll: Requesting skip data from https://static.crunchyroll.com/skip-events/production/G8WUN10Q3.json
2024-03-21 06:49:10.156 T:21268    info <general>: [PLUGIN] Crunchyroll: VideoStream: Finished to retrieve data async
2024-03-21 06:49:10.410 T:21268 warning <general>: [script.module.inputstreamhelper] Widevine update check was made on 2024-03-15 11:21
2024-03-21 06:49:10.460 T:23528    info <general>: VideoPlayer::OpenFile: plugin://plugin.video.crunchyroll/video/GRVNMG93Y/G8WUN10Q3/GQ9FG3Q8N?duration=1470
2024-03-21 06:49:10.461 T:7340     info <general>: Creating InputStream
2024-03-21 06:49:10.474 T:7340     info <general>: AddOnLog: inputstream.adaptive: [Repr. chooser] Resolution set: 3840x2160, max allowed: 3840x2160, Adjust refresh rate: 0
2024-03-21 06:49:10.474 T:7340    error <general>: XFILE::CDirectory::GetDirectory - Error getting C:\Kodi\addons\inputstream.adaptive\
2024-03-21 06:49:10.593 T:21268    info <general>: [PLUGIN] Crunchyroll: _handle_resume: starting sync thread
2024-03-21 06:49:10.594 T:25468    info <general>: [PLUGIN] Crunchyroll: thread_update_playhead() started
2024-03-21 06:49:10.594 T:21268    info <general>: [PLUGIN] Crunchyroll: _handle_skipping: required data for skipping is empty
2024-03-21 06:49:10.594 T:21268    info <general>: [PLUGIN] Crunchyroll: Starting loop
2024-03-21 06:49:40.481 T:7340    error <general>: CCurlFile::CReadState::XFILE::CCurlFile::CReadState::FillBuffer - (0x2035b450590) Failed: Timeout was reached(28)
2024-03-21 06:49:40.481 T:7340    error <general>: CCurlFile::XFILE::CCurlFile::Open - <https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-6ba4166c-d90f-489d-88a5-c324073531ab&accountid=<removed>> Failed with code 0:

2024-03-21 06:49:40.481 T:7340    error <general>: AddOnLog: inputstream.adaptive: CURLOpen returned an error, download failed: https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-6ba4166c-d90f-489d-88a5-c324073531ab&accountid=<removed>
2024-03-21 06:49:40.482 T:7340    error <general>: AddOnLog: inputstream.adaptive: Could not open / parse manifest (https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-6ba4166c-d90f-489d-88a5-c324073531ab&accountid=<removed>)
2024-03-21 06:49:40.482 T:7340    error <general>: CVideoPlayer::OpenInputStream - error opening [plugin://plugin.video.crunchyroll/video/GRVNMG93Y/G8WUN10Q3/GQ9FG3Q8N?duration=1470]
2024-03-21 06:49:40.482 T:7340     info <general>: CVideoPlayer::OnExit()
2024-03-21 06:49:40.483 T:7340     info <general>: ADDON: Dll Destroyed - InputStream Adaptive
2024-03-21 06:49:40.488 T:23528    info <general>: Loading skin file: DialogConfirm.xml, load type: KEEP_IN_MEMORY
2024-03-21 06:49:40.501 T:23528    info <general>: CVideoPlayer::CloseFile()
2024-03-21 06:49:40.501 T:23528    info <general>: VideoPlayer: waiting for threads to exit
2024-03-21 06:49:40.501 T:23528    info <general>: VideoPlayer: finished waiting
2024-03-21 06:49:40.596 T:25468   error <general>: EXCEPTION: Kodi is not playing any media file
2024-03-21 06:49:40.596 T:25468    info <general>: [PLUGIN] Crunchyroll: Playback aborted
2024-03-21 06:49:40.597 T:25468    info <general>: [PLUGIN] Crunchyroll: thread_update_playhead() has finished
2024-03-21 06:49:40.605 T:21268    info <general>: [PLUGIN] Crunchyroll: playback stopped
2024-03-21 06:49:47.690 T:23676    info <general>: [PLUGIN] Crunchyroll: VideoStream: Starting to retrieve data async
2024-03-21 06:49:47.691 T:23676    info <general>: [PLUGIN] Crunchyroll: URL: https://cr-play-service.prd.crunchyrollsvc.com/v1/G8WUN10Q3/android/phone/play
2024-03-21 06:49:47.821 T:23676    info <general>: [PLUGIN] Crunchyroll: Requesting skip data from https://static.crunchyroll.com/skip-events/production/G8WUN10Q3.json
2024-03-21 06:49:49.475 T:23676    info <general>: [PLUGIN] Crunchyroll: VideoStream: Finished to retrieve data async
2024-03-21 06:49:49.639 T:23676 warning <general>: [script.module.inputstreamhelper] Widevine update check was made on 2024-03-15 11:21
2024-03-21 06:49:49.691 T:23528    info <general>: VideoPlayer::OpenFile: plugin://plugin.video.crunchyroll/video/GRVNMG93Y/G8WUN10Q3/GQ9FG3Q8N?duration=1470
2024-03-21 06:49:49.691 T:24952    info <general>: Creating InputStream
2024-03-21 06:49:49.695 T:24952    info <general>: AddOnLog: inputstream.adaptive: [Repr. chooser] Resolution set: 3840x2160, max allowed: 3840x2160, Adjust refresh rate: 0
2024-03-21 06:49:49.695 T:24952   error <general>: XFILE::CDirectory::GetDirectory - Error getting C:\Kodi\addons\inputstream.adaptive\
2024-03-21 06:49:49.825 T:23676    info <general>: [PLUGIN] Crunchyroll: _handle_resume: starting sync thread
2024-03-21 06:49:49.825 T:27724    info <general>: [PLUGIN] Crunchyroll: thread_update_playhead() started
2024-03-21 06:49:49.825 T:23676    info <general>: [PLUGIN] Crunchyroll: _handle_skipping: required data for skipping is empty
2024-03-21 06:49:49.825 T:23676    info <general>: [PLUGIN] Crunchyroll: Starting loop
2024-03-21 06:50:19.700 T:24952   error <general>: CCurlFile::CReadState::XFILE::CCurlFile::CReadState::FillBuffer - (0x20356e0e690) Failed: Timeout was reached(28)
2024-03-21 06:50:19.700 T:24952   error <general>: CCurlFile::XFILE::CCurlFile::Open - <https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-7110c57f-713e-44c9-946f-2f3dd536662d&accountid=<removed>> Failed with code 0:

2024-03-21 06:50:19.700 T:24952   error <general>: AddOnLog: inputstream.adaptive: CURLOpen returned an error, download failed: https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-7110c57f-713e-44c9-946f-2f3dd536662d&accountid=<removed>
2024-03-21 06:50:19.701 T:24952   error <general>: AddOnLog: inputstream.adaptive: Could not open / parse manifest (https://cr-play-service.prd.crunchyrollsvc.com/v1/manifest/G8WUN10Q3/evs3/91663ab277fc4c02a4d1612797a363cb/assets/p/4e7cad61770d38f44d6c1c64ec9586b4_,5472941.mp4,5472942.mp4,5472940.mp4,5472939.mp4,5472938.mp4,.urlset/manifest.mpd?playbackGuid=08-7110c57f-713e-44c9-946f-2f3dd536662d&accountid=<removed>)
2024-03-21 06:50:19.701 T:24952   error <general>: CVideoPlayer::OpenInputStream - error opening [plugin://plugin.video.crunchyroll/video/GRVNMG93Y/G8WUN10Q3/GQ9FG3Q8N?duration=1470]
2024-03-21 06:50:19.701 T:24952    info <general>: CVideoPlayer::OnExit()
2024-03-21 06:50:19.701 T:24952    info <general>: ADDON: Dll Destroyed - InputStream Adaptive
2024-03-21 06:50:19.721 T:23528    info <general>: CVideoPlayer::CloseFile()
2024-03-21 06:50:19.721 T:23528    info <general>: VideoPlayer: waiting for threads to exit
2024-03-21 06:50:19.721 T:23528    info <general>: VideoPlayer: finished waiting
2024-03-21 06:50:19.826 T:27724   error <general>: EXCEPTION: Kodi is not playing any media file
2024-03-21 06:50:19.826 T:27724    info <general>: [PLUGIN] Crunchyroll: Playback aborted
2024-03-21 06:50:19.826 T:27724    info <general>: [PLUGIN] Crunchyroll: thread_update_playhead() has finished
2024-03-21 06:50:19.840 T:23676    info <general>: [PLUGIN] Crunchyroll: playback stopped
2024-03-21 06:50:28.799 T:25868    info <general>: [PLUGIN] Crunchyroll: VideoStream: Starting to retrieve data async
2024-03-21 06:50:28.800 T:25868    info <general>: [PLUGIN] Crunchyroll: URL: https://cr-play-service.prd.crunchyrollsvc.com/v1/GEVUZDV0Q/android/phone/play
2024-03-21 06:50:28.927 T:25868    info <general>: [PLUGIN] Crunchyroll: Requesting skip data from https://static.crunchyroll.com/skip-events/production/GEVUZDV0Q.json
2024-03-21 06:50:28.978 T:25868    info <general>: [PLUGIN] Crunchyroll: _get_skip_events: check for intro PASSED
2024-03-21 06:50:28.978 T:25868    info <general>: [PLUGIN] Crunchyroll: _get_skip_events: check for credits PASSED
2024-03-21 06:50:29.478 T:25868   error <general>: [PLUGIN] Crunchyroll: Failed to prepare stream info data
2024-03-21 06:50:29.478 T:25868   error <general>: [PLUGIN] Crunchyroll: CrunchyrollError [420] {"error":"TOO_MANY_ACTIVE_STREAMS","activeStreams":[{"deviceSubtype":"phone","accountId":"<removed>","deviceType":"android","subscription":"crunchyroll","ttl":1711021748,"country":"DE","clientId":"cr_android","active":true,"deviceId":"<removed>","token":"<removed>","assetId":"4e7cad61770d38f44d6c1c64ec9586b4","sessionType":"STREAMING","contentId":"G8WUN10Q3","usesStreamLimits":true,"pk":"ACCOUNT|f567c6ca-2f53-50da-bc84-624b5d3bd0a6","id":"STREAMING|08-6ba4166c-d90f-489d-88a5-c324073531ab","lastKeepAliveTimestamp":1711000148692,"createdTimestamp":1711000148692},{"deviceSubtype":"phone","accountId":"<removed>","deviceType":"android","subscription":"crunchyroll","ttl":1711021788,"country":"DE","clientId":"cr_android","active":true,"deviceId":"<removed>","token":"<removed>","assetId":"4e7cad61770d38f44d6c1c64ec9586b4","sessionType":"STREAMING","contentId":"G8WUN10Q3","usesStreamLimits":true,"pk":"ACCOUNT|f567c6ca-2f53-50da-bc84-624b5d3bd0a6","id":"STREAMING|08-7110c57f-713e-44c9-946f-2f3dd536662d","lastKeepAliveTimestamp":1711000188097,"createdTimestamp":1711000188097}]}
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\videoplayer.py , Line : 84, Func.Name : _get_video_stream_data, Message : self._stream_data = video_stream_helper.get_player_stream_data()
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\videostream.py , Line : 79, Func.Name : get_player_stream_data, Message : async_data = asyncio.run(self._gather_async_data())
                                                   File : C:\Kodi\system\python\Lib\asyncio\runners.py , Line : 44, Func.Name : run, Message : return loop.run_until_complete(main)
                                                   File : C:\Kodi\system\python\Lib\asyncio\base_events.py , Line : 616, Func.Name : run_until_complete, Message : return future.result()
                                                   File : C:\Kodi\system\python\Lib\asyncio\futures.py , Line : 178, Func.Name : result, Message : raise self._exception
                                                   File : C:\Kodi\system\python\Lib\asyncio\tasks.py , Line : 282, Func.Name : __step, Message : result = coro.throw(exc)
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\videostream.py , Line : 111, Func.Name : _gather_async_data, Message : results = await asyncio.gather(t_stream_data, t_skip_events_data, t_playheads, t_item_data)
                                                   File : C:\Kodi\system\python\Lib\asyncio\futures.py , Line : 260, Func.Name : __await__, Message : yield self  # This tells Task to wait for completion.
                                                   File : C:\Kodi\system\python\Lib\asyncio\tasks.py , Line : 349, Func.Name : __wakeup, Message : future.result()
                                                   File : C:\Kodi\system\python\Lib\asyncio\futures.py , Line : 178, Func.Name : result, Message : raise self._exception
                                                   File : C:\Kodi\system\python\Lib\asyncio\tasks.py , Line : 280, Func.Name : __step, Message : result = coro.send(None)
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\videostream.py , Line : 152, Func.Name : _get_stream_data_from_api_v2, Message : req = self.api.make_request(
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\api.py , Line : 248, Func.Name : make_request, Message : return get_json_from_response(r)
                                                   File : C:\Kodi\portable_data\addons\plugin.video.crunchyroll\resources\lib\api.py , Line : 382, Func.Name : get_json_from_response, Message : raise CrunchyrollError(f"[{code}] {r.text}")
2024-03-21 06:50:29.485 T:23528   error <general>: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.crunchyroll/video/GVDHX853V/GEVUZDV0Q/GXMFQW824?duration=1420]
2024-03-21 06:50:31.384 T:25868    info <general>: [PLUGIN] Crunchyroll: Starting loop
2024-03-21 06:50:31.385 T:25868    info <general>: [PLUGIN] Crunchyroll: playback stopped
smirgol commented 8 months ago

I'll think about that. Not that we can do anything about it, like closing streams or such - to my knowledge. It's super annoying and, on a side-note, it makes debugging the addon much more troublesome. sighs

Yavos commented 8 months ago

My thought was to just add a new error message telling people that there are too many active streams at the moment. This should help a lot already. If you wanted, you could even parse when the last active streams were initiated/last used and by which client id from the error message, but I personally think that's unnecessary.

smirgol commented 7 months ago

I've added an additional error message for that. Additionally I've found out how to clear active streams with CR, so, in theory, this should not happen any more.