From 9c2f91b8caab6a336a6bcc00d443b41830aec8e9 Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Sat, 25 Nov 2023 15:18:38 -0600 Subject: [PATCH] Add a bit more details to some errors. --- modules/library.py | 2 +- modules/mdblist.py | 2 +- modules/notifiarr.py | 2 +- modules/overlay.py | 4 +++- modules/plex.py | 2 +- modules/util.py | 4 +++- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/library.py b/modules/library.py index d21f5430..b8565cd7 100644 --- a/modules/library.py +++ b/modules/library.py @@ -275,7 +275,7 @@ class Library(ABC): exif_tags = image.getexif() if 0x04bc in exif_tags and exif_tags[0x04bc] == "overlay": os.remove(image_path) - raise Failed("Poster already has an Overlay") + raise Failed("This item's poster already has an Overlay. There is no PMM setting to change; manual attention required.") if remove: os.remove(image_path) else: diff --git a/modules/mdblist.py b/modules/mdblist.py index 99154574..10a43481 100644 --- a/modules/mdblist.py +++ b/modules/mdblist.py @@ -205,6 +205,6 @@ class Mdblist: results.append((item["id"], "tmdb" if item["mediatype"] == "movie" else "tmdb_show")) return results except JSONDecodeError: - raise Failed(f"Mdblist Error: Invalid Response") + raise Failed(f"Mdblist Error: Invalid JSON Response received") else: raise Failed(f"Mdblist Error: Method {method} not supported") diff --git a/modules/notifiarr.py b/modules/notifiarr.py index a58c55a6..52bd8f05 100644 --- a/modules/notifiarr.py +++ b/modules/notifiarr.py @@ -17,7 +17,7 @@ class Notifiarr: try: self.request(path="user", params={"fetch": "settings"}) except JSONDecodeError: - raise Failed("Notifiarr Error: Invalid response") + raise Failed("Notifiarr Error: Invalid JSON response received") def notification(self, json): return self.request(json=json) diff --git a/modules/overlay.py b/modules/overlay.py index e79f7ba1..4c5b323a 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -155,8 +155,10 @@ class Overlay: def get_and_save_image(image_url): response = self.config.get(image_url) - if response.status_code >= 400: + if response.status_code == 404: raise Failed(f"Overlay Error: Overlay Image not found at: {image_url}") + if response.status_code >= 400: + raise Failed(f"Overlay Error: Status {response.status_code} when attempting download of: {image_url}") if "Content-Type" not in response.headers or response.headers["Content-Type"] != "image/png": raise Failed(f"Overlay Error: Overlay Image not a png: {image_url}") if not os.path.exists(library.overlay_folder) or not os.path.isdir(library.overlay_folder): diff --git a/modules/plex.py b/modules/plex.py index d0e0ae70..12ef28a8 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -1358,7 +1358,7 @@ class Plex(Library): else: starting = item if not starting.locations: - raise Failed(f"Asset Warning: No video filepath found fo {item.title}") + raise Failed(f"Asset Warning: No video filepath found for {item.title}") path_test = str(starting.locations[0]) if not os.path.dirname(path_test): path_test = path_test.replace("\\", "/") diff --git a/modules/util.py b/modules/util.py index d402d4c5..eb620c34 100644 --- a/modules/util.py +++ b/modules/util.py @@ -170,8 +170,10 @@ def quote(data): def download_image(title, image_url, download_directory, filename=None): response = requests.get(image_url, headers=header()) + if response.status_code == 404: + raise Failed(f"Image Error: Not Found on Image URL: {image_url}") if response.status_code >= 400: - raise Failed(f"Image Error: Failed to download Image URL: {image_url}") + raise Failed(f"Image Error: {response.status_code} on Image URL: {image_url}") if "Content-Type" not in response.headers or response.headers["Content-Type"] not in image_content_types: raise Failed("Image Not PNG, JPG, or WEBP") new_image = os.path.join(download_directory, f"{filename}") if filename else download_directory