From 2bf362c696ee905e72edcc05c476ef98a63a8866 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Fri, 26 Apr 2024 18:42:39 +0200 Subject: [PATCH] fix: don't try to encode cache with encoding none --- music_kraken/connection/connection.py | 2 +- music_kraken/objects/artwork.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/music_kraken/connection/connection.py b/music_kraken/connection/connection.py index 8216c56..d15aa32 100644 --- a/music_kraken/connection/connection.py +++ b/music_kraken/connection/connection.py @@ -194,7 +194,7 @@ class Connection: additional_info = cached.attribute.additional_info body = cached.content - if "encoding" in additional_info: + if additional_info.get("encoding", None) is not None: body = body.decode(additional_info["encoding"]) resp.add( diff --git a/music_kraken/objects/artwork.py b/music_kraken/objects/artwork.py index 096f242..43ea87e 100644 --- a/music_kraken/objects/artwork.py +++ b/music_kraken/objects/artwork.py @@ -51,7 +51,7 @@ class Artwork: return min(self._variant_mapping.values(), key=lambda x: x["deviation"]) def get_variant_name(self, variant: ArtworkVariant) -> str: - return f"artwork_{variant['width']}x{variant['height']}_{hash_url(variant['url'])}" + return f"artwork_{variant['width']}x{variant['height']}_{hash_url(variant['url']).replace('/', '_')}" def __merge__(self, other: Artwork, override: bool = False) -> None: for key, value in other._variant_mapping.items():