adamgot / python-plexlibrary

Create and maintain dynamic Plex libraries based on recipes.
BSD 3-Clause "New" or "Revised" License
204 stars 40 forks source link

KeyError: 'last_air_date' #51

Open CHlLL7 opened 5 years ago

CHlLL7 commented 5 years ago

Im getting following error when running the tv_trending script:

python plexlibrary tv_trending Running the recipe 'tv_trending' Retrieving the trakt list: https://api.trakt.tv/shows/trending?limit=5 Retrieving the trakt list: https://api.trakt.tv/shows/watched/weekly?limit=20 Retrieving the trakt list: https://api.trakt.tv/shows/watched/monthly?limit=50 Retrieving the trakt list: https://api.trakt.tv/shows/watched/yearly?limit=100 Getting data from TMDb to add weighted sorting... Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/mnt/scripts/tvtrendinglibrary/python-plexlibrary/plexlibrary/main.py", line 3, in main() File "plexlibrary/plexlibrary.py", line 61, in main r.run(args.sort_only) File "plexlibrary/recipe.py", line 690, in run missing_items, list_count = self._run() File "plexlibrary/recipe.py", line 87, in _run item_list = self.weighted_sorting(item_list) File "plexlibrary/recipe.py", line 772, in weighted_sorting details['last_air_date'], '%Y-%m-%d').date() KeyError: 'last_air_date'

When using python3 I get the following error:

python3 plexlibrary tv_trending Running the recipe 'tv_trending' Retrieving the trakt list: https://api.trakt.tv/shows/trending?limit=5 Retrieving the trakt list: https://api.trakt.tv/shows/watched/weekly?limit=20 Retrieving the trakt list: https://api.trakt.tv/shows/watched/monthly?limit=50 Retrieving the trakt list: https://api.trakt.tv/shows/watched/yearly?limit=100 Getting data from TMDb to add weighted sorting... Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "plexlibrary/main.py", line 3, in main() File "plexlibrary/plexlibrary.py", line 61, in main r.run(args.sort_only) File "plexlibrary/recipe.py", line 690, in run missing_items, list_count = self._run() File "plexlibrary/recipe.py", line 87, in _run item_list = self.weighted_sorting(item_list) File "plexlibrary/recipe.py", line 752, in weighted_sorting details = self.tmdb.get_details(m['tmdb_id'], self.library_type) File "plexlibrary/tmdb.py", line 77, in get_details cache = shelve.open(self.cache_file) File "/usr/lib/python3.6/shelve.py", line 243, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "/usr/lib/python3.6/shelve.py", line 227, in init Shelf.init(self, dbm.open(filename, flag), protocol, writeback) File "/usr/lib/python3.6/dbm/init.py", line 88, in open raise error[0]("db type could not be determined") dbm.error: db type could not be determined

All movie recepies work though

rbraunschweig commented 4 years ago

For future reference, removing the TMDb cache will fix the python3 problem.

rm /tmp/tmdb_details.shelve