From 05367f9be2007487a6119eec6583ffebce0dc8aa Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 25 Apr 2022 23:10:41 -0400 Subject: [PATCH] [38] account for tmdb items that dont exist --- VERSION | 2 +- modules/overlays.py | 27 +++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index a5694a0a..154d5881 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop37 +1.16.5-develop38 diff --git a/modules/overlays.py b/modules/overlays.py index 026e7a6a..538d82ef 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -266,18 +266,21 @@ class Overlays: return key_to_overlays, properties def find_poster_url(self, item): - if isinstance(item, Movie): - if item.ratingKey in self.library.movie_rating_key_map: - return self.config.TMDb.get_movie(self.library.movie_rating_key_map[item.ratingKey]).poster_url - elif isinstance(item, (Show, Season, Episode)): - check_key = item.ratingKey if isinstance(item, Show) else item.show().ratingKey - tmdb_id = self.config.Convert.tvdb_to_tmdb(self.library.show_rating_key_map[check_key]) - if isinstance(item, Show) and item.ratingKey in self.library.show_rating_key_map: - return self.config.TMDb.get_show(tmdb_id).poster_url - elif isinstance(item, Season): - return self.config.TMDb.get_season(tmdb_id, item.seasonNumber).poster_url - elif isinstance(item, Episode): - return self.config.TMDb.get_episode(tmdb_id, item.seasonNumber, item.episodeNumber).still_url + try: + if isinstance(item, Movie): + if item.ratingKey in self.library.movie_rating_key_map: + return self.config.TMDb.get_movie(self.library.movie_rating_key_map[item.ratingKey]).poster_url + elif isinstance(item, (Show, Season, Episode)): + check_key = item.ratingKey if isinstance(item, Show) else item.show().ratingKey + tmdb_id = self.config.Convert.tvdb_to_tmdb(self.library.show_rating_key_map[check_key]) + if isinstance(item, Show) and item.ratingKey in self.library.show_rating_key_map: + return self.config.TMDb.get_show(tmdb_id).poster_url + elif isinstance(item, Season): + return self.config.TMDb.get_season(tmdb_id, item.seasonNumber).poster_url + elif isinstance(item, Episode): + return self.config.TMDb.get_episode(tmdb_id, item.seasonNumber, item.episodeNumber).still_url + except Failed as e: + logger.error(e) def get_overlay_items(self, label="Overlay", libtype=None, ignore=None): items = self.library.search(label=label, libtype=libtype)