From a20f1733f19bd7628276dcfb7d649d5ce3b753a8 Mon Sep 17 00:00:00 2001 From: Artur Y <10753921+artyorsh@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:33:22 +0100 Subject: [PATCH 1/2] case-insensitive image formats Sometimes the image format comes as `image/JPEG`, which results in an `Unsupported image format: image/JPEG` --- jellyfin/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jellyfin/client.py b/jellyfin/client.py index 2eb84d7..951f28c 100644 --- a/jellyfin/client.py +++ b/jellyfin/client.py @@ -367,7 +367,7 @@ class JellyfinClient: raise Exception(f"Failed to download image from Spotify: {response.content}") # Step 2: Check the image content type (assume it's JPEG or PNG based on the content type from the response) - content_type = response.headers.get('Content-Type') + content_type = response.headers.get('Content-Type').lower() if content_type not in ['image/jpeg', 'image/png', 'application/octet-stream']: raise Exception(f"Unsupported image format: {content_type}") # Todo: @@ -622,4 +622,4 @@ class JellyfinClient: similarity = (1 - best_score) * 100 # Convert to percentage - return similarity, best_offset \ No newline at end of file + return similarity, best_offset From 181eff22ef10b4f340f786112c9853e0267d2ba4 Mon Sep 17 00:00:00 2001 From: Artur Y Date: Sat, 7 Dec 2024 13:27:45 +0100 Subject: [PATCH 2/2] add image/webp to the list of supported cover image types --- jellyfin/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jellyfin/client.py b/jellyfin/client.py index 951f28c..d617bd0 100644 --- a/jellyfin/client.py +++ b/jellyfin/client.py @@ -368,7 +368,7 @@ class JellyfinClient: # Step 2: Check the image content type (assume it's JPEG or PNG based on the content type from the response) content_type = response.headers.get('Content-Type').lower() - if content_type not in ['image/jpeg', 'image/png', 'application/octet-stream']: + if content_type not in ['image/jpeg', 'image/png', 'image/webp', 'application/octet-stream']: raise Exception(f"Unsupported image format: {content_type}") # Todo: if content_type == 'application/octet-stream':