xbmc / metadata.themoviedb.org.python

Other
44 stars 40 forks source link

Failure to scrape on 3.0.0 due to `tag` key #217

Closed jecassis closed 2 months ago

jecassis commented 2 months ago

From kodi.log:

error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                  - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                 Error Type: <class 'KeyError'>
                 Error Contents: 'tag'
                 Traceback (most recent call last):
                   File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.themoviedb.org.python/python/scraper.py", line 224, in <module>
                     run()
                   File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.themoviedb.org.python/python/scraper.py", line 213, in run
                     enddir = not get_details(unique_ids, params['handle'], settings, fail_silently='uniqueIDs' in params)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                   File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.themoviedb.org.python/python/scraper.py", line 143, in get_details
                     set_info(infotag, details['info'])
                   File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.themoviedb.org.python/python/scraper.py", line 163, in set_info
                     infotag.setTags(info_dict['tag'])
                                     ~~~~~~~~~^^^^^^^
                 KeyError: 'tag'
                 -->End of Python script error report<--

error <general>: Process: Error getting details from {"tmdb": "correct_TMDB_ID"}

It appears the error was introduced by commit 1bfb34a and points to this line. Reverting version to 2.2.1 scraping works as intended.

I apologize that I do not know what the expected value into the dictionary scraped from the API would be expected or if it would be expected on every scrape. And since the failure gets to that line seems the dictionary is partially populated and because the TMDB ID is correct some data was grabbed. Possibly tag also needs a if 'tag' in info_dict: check as some other keys?

If it was not clear from the paths, the log and the failure are from a kodi-21.0-Omega-armeabi-v7a install. Hope this helps.

rmrector commented 2 months ago

Cheers. A fix has been included in version 3.0.1, which should be available in Kodi in a day or two.

jecassis commented 2 months ago

Thank you, my friend. I will check it out as soon as it is available.