smirgol / plugin.video.crunchyroll

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

Exception upon opening queue #7

Closed L3ndude closed 9 months ago

L3ndude commented 9 months ago

Hi @smirgol,

First off thanks for trying to get this addon back to work. I tried it out and unfortunately it didn't work so well for me. Whenever I try to open my Queue, the addon throws an exception. I think it has something to do a certain anime (and its thumbnail?). I was able to load up my history and Anime -> Popular without any problems.

First some system info: Kodi version: 19.5 OS: OSMC 2023.01-1 Device: Vero 4K Python: 3.9.2

And before you look at the logs, yes, I am a sucker for isekai anime's. Don't judge me. 😜

2023-12-19 23:16:28.431 T:23034    INFO <general>: initializing python engine.
2023-12-19 23:16:33.580 T:23034   ERROR <general>: [PLUGIN] Crunchyroll: CrunchyrollError : queue | Failed to add item to queue view: {
                                                       "panel": {
                                                           "linked_resource_key": "cms:/episodes/GK9U3DNWQ",
                                                           "slug": "",
                                                           "promo_title": "",
                                                           "type": "episode",
                                                           "__class__": "panel",
                                                           "id": "GK9U3DNWQ",
                                                           "external_id": "EPI.895522",
                                                           "episode_metadata": {
                                                               "audio_locale": "ja-JP",
                                                               "availability_ends": "9998-11-30T08:00:00Z",
                                                               "availability_notes": "",
                                                               "availability_starts": "2023-06-24T18:45:00Z",
                                                               "available_date": null,
                                                               "available_offline": true,
                                                               "closed_captions_available": false,
                                                               "duration_ms": 1411996,
                                                               "eligible_region": "NL",
                                                               "episode": "12",
                                                               "episode_air_date": "2023-06-25T02:00:00+09:00",
                                                               "episode_number": 12,
                                                               "extended_maturity_rating": {},
                                                               "free_available_date": "9998-11-30T08:00:00Z",
                                                               "identifier": "",
                                                               "is_clip": false,
                                                               "is_dubbed": false,
                                                               "is_mature": false,
                                                               "is_premium_only": true,
                                                               "is_subbed": true,
                                                               "mature_blocked": false,
                                                               "maturity_ratings": [
                                                                   "TV-14"
                                                               ],
                                                               "premium_available_date": "2023-06-24T18:45:00Z",
                                                               "premium_date": null,
                                                               "season_id": "G63VC20N5",
                                                               "season_number": 1,
                                                               "season_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "season_title": "Summoned to Another World for a Second Time",
                                                               "sequence_number": 12,
                                                               "series_id": "G9VHN91G5",
                                                               "series_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "series_title": "Summoned to Another World for a Second Time",
                                                               "subtitle_locales": [
                                                                   "en-US",
                                                                   "es-419",
                                                                   "es-ES",
                                                                   "fr-FR",
                                                                   "pt-BR",
                                                                   "ar-SA",
                                                                   "it-IT",
                                                                   "de-DE",
                                                                   "ru-RU",
                                                                   "hi-IN"
                                                               ],
                                                               "tenant_categories": [
                                                                   "Action",
                                                                   "Comedy",
                                                                   "Fantasy"
                                                               ],
                                                               "upload_date": "2023-06-25T02:00:00+09:00",
                                                               "versions": null
                                                           },
                                                           "__actions__": {},
                                                           "channel_id": "crunchyroll",
                                                           "promo_description": "",
                                                           "title": "Fighting the Last Battle for a Second Time",
                                                           "description": "Setsu and Toma finally face each other in combat. The gruelling battle forces them to confront their shared past... but will it be enough to save both their worlds?",
                                                           "slug_title": "fighting-the-last-battle-for-a-second-time",
                                                           "__href__": "",
                                                           "__links__": {
                                                               "episode/season": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/seasons/G63VC20N5"
                                                               },
                                                               "episode/series": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/series/G9VHN91G5"
                                                               },
                                                               "resource": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/episodes/GK9U3DNWQ"
                                                               },
                                                               "resource/channel": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/channels/crunchyroll"
                                                               },
                                                               "streams": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/videos/G3WFXZ28Q/streams"
                                                               }
                                                           },
                                                           "images": {}
                                                       },
                                                       "new": false,
                                                       "new_content": false,
                                                       "is_favorite": true,
                                                       "never_watched": false,
                                                       "completion_status": true,
                                                       "playhead": 1408,
                                                       "__class__": "continue_watching_item",
                                                       "__href__": "",
                                                       "__links__": {},
                                                       "__actions__": {}
                                                   }
2023-12-19 23:16:33.580 T:23034   ERROR <general>: [PLUGIN] Crunchyroll: trace :  TypeError 'NoneType' object is not subscriptable ['File : /home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/controller.py , Line : 68, Func.Name : show_queue, Message : entry = EpisodeData(item)', 'File : /home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/model.py , Line : 206, Func.Name : __init__, Message : self.thumb: str = data.get("panel").get("images").get("thumbnail")[-1][-1][']
2023-12-19 23:16:33.596 T:23034   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'resources.lib.model.CrunchyrollError'>
                                                   Error Contents: queue | Failed to add item to queue view: {
                                                       "panel": {
                                                           "linked_resource_key": "cms:/episodes/GK9U3DNWQ",
                                                           "slug": "",
                                                           "promo_title": "",
                                                           "type": "episode",
                                                           "__class__": "panel",
                                                           "id": "GK9U3DNWQ",
                                                           "external_id": "EPI.895522",
                                                           "episode_metadata": {
                                                               "audio_locale": "ja-JP",
                                                               "availability_ends": "9998-11-30T08:00:00Z",
                                                               "availability_notes": "",
                                                               "availability_starts": "2023-06-24T18:45:00Z",
                                                               "available_date": null,
                                                               "available_offline": true,
                                                               "closed_captions_available": false,
                                                               "duration_ms": 1411996,
                                                               "eligible_region": "NL",
                                                               "episode": "12",
                                                               "episode_air_date": "2023-06-25T02:00:00+09:00",
                                                               "episode_number": 12,
                                                               "extended_maturity_rating": {},
                                                               "free_available_date": "9998-11-30T08:00:00Z",
                                                               "identifier": "",
                                                               "is_clip": false,
                                                               "is_dubbed": false,
                                                               "is_mature": false,
                                                               "is_premium_only": true,
                                                               "is_subbed": true,
                                                               "mature_blocked": false,
                                                               "maturity_ratings": [
                                                                   "TV-14"
                                                               ],
                                                               "premium_available_date": "2023-06-24T18:45:00Z",
                                                               "premium_date": null,
                                                               "season_id": "G63VC20N5",
                                                               "season_number": 1,
                                                               "season_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "season_title": "Summoned to Another World for a Second Time",
                                                               "sequence_number": 12,
                                                               "series_id": "G9VHN91G5",
                                                               "series_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "series_title": "Summoned to Another World for a Second Time",
                                                               "subtitle_locales": [
                                                                   "en-US",
                                                                   "es-419",
                                                                   "es-ES",
                                                                   "fr-FR",
                                                                   "pt-BR",
                                                                   "ar-SA",
                                                                   "it-IT",
                                                                   "de-DE",
                                                                   "ru-RU",
                                                                   "hi-IN"
                                                               ],
                                                               "tenant_categories": [
                                                                   "Action",
                                                                   "Comedy",
                                                                   "Fantasy"
                                                               ],
                                                               "upload_date": "2023-06-25T02:00:00+09:00",
                                                               "versions": null
                                                           },
                                                           "__actions__": {},
                                                           "channel_id": "crunchyroll",
                                                           "promo_description": "",
                                                           "title": "Fighting the Last Battle for a Second Time",
                                                           "description": "Setsu and Toma finally face each other in combat. The gruelling battle forces them to confront their shared past... but will it be enough to save both their worlds?",
                                                           "slug_title": "fighting-the-last-battle-for-a-second-time",
                                                           "__href__": "",
                                                           "__links__": {
                                                               "episode/season": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/seasons/G63VC20N5"
                                                               },
                                                               "episode/series": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/series/G9VHN91G5"
                                                               },
                                                               "resource": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/episodes/GK9U3DNWQ"
                                                               },
                                                               "resource/channel": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/channels/crunchyroll"
                                                               },
                                                               "streams": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/videos/G3WFXZ28Q/streams"
                                                               }
                                                           },
                                                           "images": {}
                                                       },
                                                       "new": false,
                                                       "new_content": false,
                                                       "is_favorite": true,
                                                       "never_watched": false,
                                                       "completion_status": true,
                                                       "playhead": 1408,
                                                       "__class__": "continue_watching_item",
                                                       "__href__": "",
                                                       "__links__": {},
                                                       "__actions__": {}
                                                   }
                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/controller.py", line 68, in show_queue
                                                       entry = EpisodeData(item)
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/model.py", line 206, in __init__
                                                       self.thumb: str = data.get("panel").get("images").get("thumbnail")[-1][-1][
                                                   TypeError: 'NoneType' object is not subscriptable

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/default.py", line 33, in <module>
                                                       crunchyroll.main(sys.argv)
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/crunchyroll.py", line 106, in main
                                                       check_mode(args, api)
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/crunchyroll.py", line 137, in check_mode
                                                       controller.show_queue(args, api)
                                                     File "/home/osmc/.kodi/addons/plugin.video.crunchyroll/resources/lib/controller.py", line 105, in show_queue
                                                       raise CrunchyrollError("queue | Failed to add item to queue view: %s" % json.dumps(item, indent=4))
                                                   resources.lib.model.CrunchyrollError: queue | Failed to add item to queue view: {
                                                       "panel": {
                                                           "linked_resource_key": "cms:/episodes/GK9U3DNWQ",
                                                           "slug": "",
                                                           "promo_title": "",
                                                           "type": "episode",
                                                           "__class__": "panel",
                                                           "id": "GK9U3DNWQ",
                                                           "external_id": "EPI.895522",
                                                           "episode_metadata": {
                                                               "audio_locale": "ja-JP",
                                                               "availability_ends": "9998-11-30T08:00:00Z",
                                                               "availability_notes": "",
                                                               "availability_starts": "2023-06-24T18:45:00Z",
                                                               "available_date": null,
                                                               "available_offline": true,
                                                               "closed_captions_available": false,
                                                               "duration_ms": 1411996,
                                                               "eligible_region": "NL",
                                                               "episode": "12",
                                                               "episode_air_date": "2023-06-25T02:00:00+09:00",
                                                               "episode_number": 12,
                                                               "extended_maturity_rating": {},
                                                               "free_available_date": "9998-11-30T08:00:00Z",
                                                               "identifier": "",
                                                               "is_clip": false,
                                                               "is_dubbed": false,
                                                               "is_mature": false,
                                                               "is_premium_only": true,
                                                               "is_subbed": true,
                                                               "mature_blocked": false,
                                                               "maturity_ratings": [
                                                                   "TV-14"
                                                               ],
                                                               "premium_available_date": "2023-06-24T18:45:00Z",
                                                               "premium_date": null,
                                                               "season_id": "G63VC20N5",
                                                               "season_number": 1,
                                                               "season_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "season_title": "Summoned to Another World for a Second Time",
                                                               "sequence_number": 12,
                                                               "series_id": "G9VHN91G5",
                                                               "series_slug_title": "summoned-to-another-world-for-a-second-time",
                                                               "series_title": "Summoned to Another World for a Second Time",
                                                               "subtitle_locales": [
                                                                   "en-US",
                                                                   "es-419",
                                                                   "es-ES",
                                                                   "fr-FR",
                                                                   "pt-BR",
                                                                   "ar-SA",
                                                                   "it-IT",
                                                                   "de-DE",
                                                                   "ru-RU",
                                                                   "hi-IN"
                                                               ],
                                                               "tenant_categories": [
                                                                   "Action",
                                                                   "Comedy",
                                                                   "Fantasy"
                                                               ],
                                                               "upload_date": "2023-06-25T02:00:00+09:00",
                                                               "versions": null
                                                           },
                                                           "__actions__": {},
                                                           "channel_id": "crunchyroll",
                                                           "promo_description": "",
                                                           "title": "Fighting the Last Battle for a Second Time",
                                                           "description": "Setsu and Toma finally face each other in combat. The gruelling battle forces them to confront their shared past... but will it be enough to save both their worlds?",
                                                           "slug_title": "fighting-the-last-battle-for-a-second-time",
                                                           "__href__": "",
                                                           "__links__": {
                                                               "episode/season": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/seasons/G63VC20N5"
                                                               },
                                                               "episode/series": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/series/G9VHN91G5"
                                                               },
                                                               "resource": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/episodes/GK9U3DNWQ"
                                                               },
                                                               "resource/channel": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/channels/crunchyroll"
                                                               },
                                                               "streams": {
                                                                   "href": "/cms/v2/NL/M3/crunchyroll/videos/G3WFXZ28Q/streams"
                                                               }
                                                           },
                                                           "images": {}
                                                       },
                                                       "new": false,
                                                       "new_content": false,
                                                       "is_favorite": true,
                                                       "never_watched": false,
                                                       "completion_status": true,
                                                       "playhead": 1408,
                                                       "__class__": "continue_watching_item",
                                                       "__href__": "",
                                                       "__links__": {},
                                                       "__actions__": {}
                                                   }
                                                   -->End of Python script error report<--

2023-12-19 23:16:33.749 T:23034    INFO <general>: Python interpreter stopped
2023-12-19 23:16:33.749 T:23033   ERROR <general>: GetDirectory - Error getting plugin://plugin.video.crunchyroll/?mode=queue&title=Queue
2023-12-19 23:16:33.777 T:21527   ERROR <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.crunchyroll/?mode=queue&title=Queue) failed
smirgol commented 9 months ago

Who am I to judge? :D Sorry for the error, I messed up the error handling, it should have simply skipped that entry and silently continue and also log less data. I have now fixed the error - if there is no image, it will no longer crash but simply don't show an image.

L3ndude commented 9 months ago

Nice! That fixed it! Thanks!