From 0129210d76add06768475b721fd8425cd61ba1f7 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 6 Jul 2021 15:59:55 -0400 Subject: [PATCH] check status code --- modules/builder.py | 5 ++--- modules/plex.py | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 736e4fc7..7e4defe0 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1710,9 +1710,8 @@ class CollectionBuilder: if self.details["item_assets"] or overlay is not None: try: self.library.update_item_from_assets(item, overlay=overlay) - except UnidentifiedImageError: - util.print_stacktrace() - logger.error(f"Overlay Error: Overlay Failed for {item.title}") + except Failed as e: + logger.error(e) self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags) if "item_radarr_tag" in self.item_details and item.ratingKey in self.library.movie_rating_key_map: tmdb_ids.append(self.library.movie_rating_key_map[item.ratingKey]) diff --git a/modules/plex.py b/modules/plex.py index f39b2845..f6045fef 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -459,7 +459,10 @@ class Plex: if self.config.Cache: image, _, image_overlay = self.config.Cache.query_image_map(item.ratingKey, self.original_mapping_name, "poster") if poster_uploaded or not image_overlay or image_overlay != overlay_name: - og_image = requests.get(item.posterUrl).content + response = requests.get(item.posterUrl) + if response.status_code >= 400: + raise Failed(f"Overlay Error: Overlay Failed for {item.title}") + og_image = response.content with open(temp_image, "wb") as handler: handler.write(og_image) shutil.copyfile(temp_image, os.path.join(overlay_folder, f"{item.ratingKey}.png"))