ZeroQI / Hama.bundle

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

Acquering first time metadata: raise on tmdbid.split(","): int is not iterable #267

Closed whinette closed 5 years ago

whinette commented 5 years ago

Related logs:

Urusei Yatsura Remember My Love [anidb-380].agent-update.log com.plexapp.agents.hama.log

I've attached the file log of the latest raise. scanner and hama are up to date (updated this afternoon).

ZeroQI commented 5 years ago
  File "/storage/emulated/0/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/FanartTV.py", line 20, in GetMetadata
    if "," in tmdbid:  (GetMetadata(metadata, movie, "", tmdbid_unique, "", season, num) for tmdbid_unique in tmdbid.split(","));             return  #recusive call for each tmdbid to reduce complexity
TypeError: argument of type 'int' is not iterable

seem like tmdbid is int and not string. will correct shortly

EndOfLine369 commented 5 years ago

Applied fix. Please test.

whinette commented 5 years ago

I'm not unable to test until tomorrow, will do and feedback ASAP. Thanks!

whinette commented 5 years ago

A new error:

2018-12-25 19:39:17,168 (24225f94f0) :  CRITICAL (agentkit:1078) - Exception in the update function of agent named 'HamaMovies', called with guid 'com.plexapp.agents.hama://anidb-383?lang=en' (most recent call last):
  File "/data/data/com.plexapp.mediaserver.smb/Resources/Plug-ins-cc260c476/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in _update
    agent.update(obj, media, lang, **kwargs)
  File "/storage/emulated/0/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/__init__.py", line 147, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  True)
  File "/storage/emulated/0/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/__init__.py", line 122, in Update
    dict_OMDb                                                     =        OMDb.GetMetadata(movie, IMDbid) if Prefs['OMDbApiKey'] not in ('None', '', 'N/A') else {}  #TVDBid=='hentai'
  File "/storage/emulated/0/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/OMDb.py", line 35, in GetMetadata
    if Dict(json,'Poster'):  SaveDict(os.path.join('OMDb', 'poster', imdbid_single+'.jpg', num, None), OMDb_dict, 'posters', json['Poster'])
  File "/data/user/0/com.plexapp.mediaserver.smb/Resources/Python/lib/python2.7/posixpath.py", line 68, in join
    if b.startswith('/'):
AttributeError: 'int' object has no attribute 'startswith'
EndOfLine369 commented 5 years ago

@ZeroQI, looks like it needs to be fixed to this? Missing correct bracketing? Around the 'os.path.join'

FROM:
if Dict(json,'Poster'):  SaveDict(os.path.join('OMDb', 'poster', imdbid_single+'.jpg', num, None), OMDb_dict, 'posters', json['Poster'])
TO:
if Dict(json,'Poster'):  SaveDict((os.path.join('OMDb', 'poster', imdbid_single+'.jpg'), num, None), OMDb_dict, 'posters', json['Poster'])
ZeroQI commented 5 years ago

@EndOfLine369 Should be a tuple added of poster URL, image rank and thumb URL if any, then the dict variable then the nested fields list: if Dict(json,'Poster'): SaveDict((os.path.join('OMDb', 'poster', imdbid_single+'.jpg'), num, None), OMDb_dict, 'posters', json['Poster'])

EndOfLine369 commented 5 years ago

Yep, you and I got the same thing for the bracket fix. Couldn't remember the format requirements at this time so just wanted to check 😄 Will commit.

ZeroQI commented 5 years ago

Thanks for that.

EndOfLine369 commented 5 years ago

@whinette Please check again. Thanks for helping us catch/fix these bugs. 😁

whinette commented 5 years ago

Looks good. :)