diff --git a/VERSION b/VERSION index ae54344d..f6edf455 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.0-develop8 +1.17.0-develop9 diff --git a/modules/builder.py b/modules/builder.py index 06909293..62ed1da0 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -5,6 +5,7 @@ from modules.util import Failed, NotScheduled, NotScheduledRange, Overlay, Delet from plexapi.audio import Artist, Album, Track from plexapi.exceptions import BadRequest, NotFound from plexapi.video import Movie, Show, Season, Episode +from requests.exceptions import ConnectionError from urllib.parse import quote logger = util.logger @@ -787,11 +788,13 @@ class CollectionBuilder: def _poster(self, method_name, method_data): if method_name == "url_poster": - image_response = self.config.get(method_data, headers=util.header()) - if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: - logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}") - else: + try: + image_response = self.config.get(method_data, headers=util.header()) + if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: + raise ConnectionError self.posters[method_name] = method_data + except ConnectionError: + logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}") elif method_name == "tmdb_poster": self.posters[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).poster_url elif method_name == "tmdb_profile": @@ -806,11 +809,13 @@ class CollectionBuilder: def _background(self, method_name, method_data): if method_name == "url_background": - image_response = self.config.get(method_data, headers=util.header()) - if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: - logger.warning(f"{self.Type} Warning: No Background Found at {method_data}") - else: + try: + image_response = self.config.get(method_data, headers=util.header()) + if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]: + raise ConnectionError self.backgrounds[method_name] = method_data + except ConnectionError: + logger.warning(f"{self.Type} Warning: No Background Found at {method_data}") elif method_name == "tmdb_background": self.backgrounds[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).backdrop_url elif method_name == "tvdb_background":