Add a bit more details to some errors.

pull/1741/head
Chaz Larson 1 year ago
parent 19dac0b6b1
commit 9c2f91b8ca

@ -275,7 +275,7 @@ class Library(ABC):
exif_tags = image.getexif() exif_tags = image.getexif()
if 0x04bc in exif_tags and exif_tags[0x04bc] == "overlay": if 0x04bc in exif_tags and exif_tags[0x04bc] == "overlay":
os.remove(image_path) 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: if remove:
os.remove(image_path) os.remove(image_path)
else: else:

@ -205,6 +205,6 @@ class Mdblist:
results.append((item["id"], "tmdb" if item["mediatype"] == "movie" else "tmdb_show")) results.append((item["id"], "tmdb" if item["mediatype"] == "movie" else "tmdb_show"))
return results return results
except JSONDecodeError: except JSONDecodeError:
raise Failed(f"Mdblist Error: Invalid Response") raise Failed(f"Mdblist Error: Invalid JSON Response received")
else: else:
raise Failed(f"Mdblist Error: Method {method} not supported") raise Failed(f"Mdblist Error: Method {method} not supported")

@ -17,7 +17,7 @@ class Notifiarr:
try: try:
self.request(path="user", params={"fetch": "settings"}) self.request(path="user", params={"fetch": "settings"})
except JSONDecodeError: except JSONDecodeError:
raise Failed("Notifiarr Error: Invalid response") raise Failed("Notifiarr Error: Invalid JSON response received")
def notification(self, json): def notification(self, json):
return self.request(json=json) return self.request(json=json)

@ -155,8 +155,10 @@ class Overlay:
def get_and_save_image(image_url): def get_and_save_image(image_url):
response = self.config.get(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}") 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": 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}") 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): if not os.path.exists(library.overlay_folder) or not os.path.isdir(library.overlay_folder):

@ -1358,7 +1358,7 @@ class Plex(Library):
else: else:
starting = item starting = item
if not starting.locations: 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]) path_test = str(starting.locations[0])
if not os.path.dirname(path_test): if not os.path.dirname(path_test):
path_test = path_test.replace("\\", "/") path_test = path_test.replace("\\", "/")

@ -170,8 +170,10 @@ def quote(data):
def download_image(title, image_url, download_directory, filename=None): def download_image(title, image_url, download_directory, filename=None):
response = requests.get(image_url, headers=header()) 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: 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: 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") raise Failed("Image Not PNG, JPG, or WEBP")
new_image = os.path.join(download_directory, f"{filename}") if filename else download_directory new_image = os.path.join(download_directory, f"{filename}") if filename else download_directory

Loading…
Cancel
Save