check status code

pull/322/head
meisnate12 3 years ago
parent b5dafed1d8
commit 0129210d76

@ -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])

@ -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"))

Loading…
Cancel
Save