ZeroQI / Hama.bundle

Plex HTTP Anidb Metadata Agent (HAMA)
GNU General Public License v3.0
1.21k stars 113 forks source link

[Beta] Crash while trying to match Idolmaster Cinderella Girls Gekijou [anidb-12483] #188

Closed KurtzPT closed 6 years ago

KurtzPT commented 6 years ago

This is the following log after it tries to match the anime via refresh metadata:

2018-05-04 15:27:22,607 (6f2ac54da700) : DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.hama/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo/Y2VyZWFsMQoxCmRpY3QKMTAKczIKZW5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgozMzM0ODdzNApkYmlkaTAKczcKdmVyc2lvbm5zMTAKcGFyZW50R1VJRG5zOApwYXJlbnRJRHM3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZXM0NQpjb20ucGxleGFwcC5hZ2VudHMuaGFtYTovL2FuaWRiLTEyNDgzP2xhbmc9ZW5zNApndWlkczExCmFuaWRiLTEyNDgzczIKaWRyMAo 2018-05-04 15:27:22,608 (6f2ac54da700) : DEBUG (runtime:49) - Received packed state data (1524 bytes) 2018-05-04 15:27:22,609 (6f2ac54da700) : DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.hama/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo/Y2VyZWFsMQoxCmRpY3QKMTAKczIKZW5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNgozMzM0ODdzNApkYmlkaTAKczcKdmVyc2lvbm5zMTAKcGFyZW50R1VJRG5zOApwYXJlbnRJRHM3ClRWX1Nob3dzMTAKbWVkaWFfdHlwZXM0NQpjb20ucGxleGFwcC5hZ2VudHMuaGFtYTovL2FuaWRiLTEyNDgzP2xhbmc9ZW5zNApndWlkczExCmFuaWRiLTEyNDgzczIKaWRyMAo 2018-05-04 15:27:22,610 (6f2ac54da700) : DEBUG (model:32) - Loading model with GUID com.plexapp.agents.hama://anidb-12483?lang=en 2018-05-04 15:27:22,610 (6f2ac54da700) : DEBUG (model:234) - Deserializing from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/TV Shows/3/9adb1eb3fc2e3b74597155a06345aa687fc5eaa.bundle/Contents/com.plexapp.agents.hama/Info.xml 2018-05-04 15:27:22,611 (6f2ac54da700) : DEBUG (networking:166) - Requesting 'http://127.0.0.1:32400/library/metadata/333487/tree' 2018-05-04 15:27:22,620 (6f2ac54da700) : DEBUG (common:78) - GetLibraryRootPath() - library: '', path: 'Idolmaster Cinderella Girls Gekijou [anidb-12483]', root: '/mnt/plexdrive/anime', dir:'/mnt/plexdrive/anime/Idolmaster Cinderella Girls Gekijou [anidb-12483]', PLEX_LIBRARY: '{}' 2018-05-04 15:27:22,621 (6f2ac54da700) : DEBUG (common:106) - Log file: /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs/Idolmaster Cinderella Girls Gekijou [anidb-12483].agent-update.log 2018-05-04 15:27:22,621 (6f2ac54da700) : INFO (init:98) - === Update ================================================================================================================================================== 2018-05-04 15:27:22,621 (6f2ac54da700) : INFO (init:99) - id: anidb-12483, title: None, lang: en, force: True, movie: False 2018-05-04 15:27:22,621 (6f2ac54da700) : INFO (AnimeLists:55) - ------------------------------------------------------------------------------------------------------------------------------------------------------------- 2018-05-04 15:27:22,633 (6f2ac54da700) : INFO (AnimeLists:96) - AnimeLists.GetMetadata() - AniDBid: 12483, TVDBid: 326337, defaulttvdbseason: 1, episodeoffset: 0, name: Idolmaster Cinderella Girls Gekijou 2018-05-04 15:27:22,640 (6f2ac54da700) : INFO (AnimeLists:119) - anidbTvdbMapping() - mappingList: {'defaulttvdbseason': '1', 'name': 'Idolmaster Cinderella Girls Gekijou', 'episodeoffset': '0'} 2018-05-04 15:27:22,640 (6f2ac54da700) : INFO (AniDB:33) - ------------------------------------------------------------------------------------------------------------------------------------------------------------- 2018-05-04 15:27:22,641 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - AniDBid: 12483, AniDBids list: ['12483'], AniDBids present on disk: ['12483'] 2018-05-04 15:27:22,641 (6f2ac54da700) : DEBUG (common:221) - common.LoadFile() - CacheTime: 'Fri May 4 15:04:24 2018', Limit: 'Thu May 10 15:27:22 2018', url: 'http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=12483', Filename: 'AniDB/xml/12483.xml' loaded from cache 2018-05-04 15:27:22,642 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - AniDBid: 12483 ------------------------------------------------------------------------------------------------------------------------ 2018-05-04 15:27:22,642 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - 'title': The Idolmaster Cinderella Girls Theater, 'title_sort': Idolmaster Cinderella Girls Theater, original_title: Idolmaster Cinderella Girls Gekijou 2018-05-04 15:27:22,642 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - 'originally_available_at': '2017-04-04' 2018-05-04 15:27:22,643 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - 'summary' empty: 'False' 2018-05-04 15:27:22,643 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - 'rating': '3.66' 2018-05-04 15:27:22,647 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - 'genre' (10/41 above 400 weight): ['Idol', 'Present', 'Earth', 'Absurdist humour', 'Super deformed', 'Japan', 'Music', 'Asia', 'The arts', 'Working life'] 2018-05-04 15:27:22,647 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - collections 2018-05-04 15:27:22,649 (6f2ac54da700) : INFO (AniDB:174) - AniDBid is not part of any collection, related_anime_list: '{'13274': (0, ''), '10585': (0, '')}' 2018-05-04 15:27:22,649 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - Roles: 2018-05-04 15:27:22,649 (6f2ac54da700) : INFO (AniDB:174) - AniDB.GetMetadata() - creators tag: {'producers': ['Mankyuu'], 'directors': ['Mankyuu'], 'writers': ['Bandai Namco Entertainment']} 2018-05-04 15:27:22,661 (6f2ac54da700) : INFO (AniDB:178) - AniDB.get_metadata() - Duration: 39, numEpisodes: 13, average duration: 3 2018-05-04 15:27:22,661 (6f2ac54da700) : INFO (AniDB:206) - AniDB.get_metadata() - ANNid: '19183', MALid: '35805', xml loaded: 'True' 2018-05-04 15:27:22,662 (6f2ac54da700) : INFO (TheTVDBv2:68) - ------------------------------------------------------------------------------------------------------------------------------------------------------------- 2018-05-04 15:27:22,662 (6f2ac54da700) : INFO (TheTVDBv2:69) - TheTVDB.GetMetadata() - TVDBid: '326337', IMDbid: '' 2018-05-04 15:27:22,662 (6f2ac54da700) : INFO (TheTVDBv2:170) - language_series : ['en', 'main', 'x-jat', 'jap'], language_episodes: ['en', 'main', 'x-jat', 'jap'] 2018-05-04 15:27:22,663 (6f2ac54da700) : DEBUG (networking:166) - Requesting 'https://api.thetvdb.com/series/326337/actors' 2018-05-04 15:27:23,255 (6f2ac54da700) : INFO (TheTVDBv2:170) - TheTVDB.GetMetadata() - TVDB_ACTORS_URL: https://api.thetvdb.com/series/326337/actors, actor_json: None 2018-05-04 15:27:23,255 (6f2ac54da700) : CRITICAL (agentkit:1078) - Exception in the update function of agent named 'HamaTV', called with guid 'com.plexapp.agents.hama://anidb-12483?lang=en' (most recent call last): File "/usr/lib/plexmediaserver/Resources/Plug-ins-215c28d86/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in _update agent.update(obj, media, lang, **kwargs) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py", line 125, in update def update (self, metadata, media, lang, force ): Update (metadata, media, lang, force, False) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py", line 103, in Update dict_TheTVDB, IMDbid = TheTVDBv2.GetMetadata(media, movie, error_log, lang, source, AniDBid, TVDBid, IMDbid, mappingList, Dict(AniDB, 'movie')) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/TheTVDBv2.py", line 170, in GetMetadata if season!='0': abs_number = str(int(abs_number) + 1) File "/usr/lib/plexmediaserver/Resources/Plug-ins-215c28d86/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 107, in getiter = lambda x: x.iter(), AttributeError: 'NoneType' object has no attribute 'iter'

2018-05-04 15:27:23,256 (6f2ac54da700) : DEBUG (model:229) - Serializing to /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/TV Shows/3/9adb1eb3fc2e3b74597155a06345aa687fc5eaa.bundle/Contents/com.plexapp.agents.hama/Info.xml 2018-05-04 15:27:23,258 (6f2ac54da700) : DEBUG (runtime:88) - Sending packed state data (1548 bytes) 2018-05-04 15:27:23,259 (6f2ac54da700) : DEBUG (runtime:924) - Response: [200] str, 16 bytes

KurtzPT commented 6 years ago

The same thing happens to The Idolmaster Side M [anidb-12820]

KurtzPT commented 6 years ago

I fixed the problem myself.

On TVDBv2.py:

### TVDB Series Actors JSON ### if not Prefs["GetSingleOne"]: #cache= CACHE_1MONTH, url=API_ACTORS_URL.replace('.com', '.plexapp.com') try: actor_json = GetResultFromNetwork(TVDB_ACTORS_URL % TVDBid, additionalHeaders={'Accept-Language': lang} if lang!='en' else {})['data'] except KeyError: Log("Bad actor data, no update for TVDB id: %s" % TVDBid); actor_json = None else: #JSON format: 'data': [{"seriesId", "name", "image", "lastUpdated", "imageAuthor", "role", "sortOrder", "id", "imageAdded", },...] Log("TheTVDB.GetMetadata() - TVDB_ACTORS_URL: {}, actor_json: {}".format(TVDB_ACTORS_URL % TVDBid, actor_json)) TheTVDB_dict['roles'] = [] for role in actor_json:

When the result of actor_json is None, it will crash at the start of the for loop. I just simply added this line before the for loop: if actor_json is not None: