Fix: Subsonic: Catch DataNotFoundError for artwork (#2012)
authorEric Munson <eric@munsonfam.org>
Sun, 9 Mar 2025 23:04:25 +0000 (19:04 -0400)
committerGitHub <noreply@github.com>
Sun, 9 Mar 2025 23:04:25 +0000 (00:04 +0100)
This exception simply means that there is no artwork to return (and
probably shouldn't be an exception, but there we are). We will catch
this exception and return None.

Fixes: https://github.com/music-assistant/support/issues/3610
Signed-off-by: Eric B Munson <eric@munsonfam.org>
music_assistant/providers/opensubsonic/sonic_provider.py

index ccaae114f1237628311e9cfe855b5b7499c4c222..30af636900227724c6af2f2fcc23d2a06aed5f6c 100644 (file)
@@ -384,8 +384,12 @@ class OpenSonicProvider(MusicProvider):
         """Return the image."""
 
         def _get_cover_art() -> bytes | Any:
-            with self._conn.getCoverArt(path) as art:
-                return art.content
+            try:
+                with self._conn.getCoverArt(path) as art:
+                    return art.content
+            except DataNotFoundError:
+                self.logger.warning("Unable to locate a cover image for %s", path)
+                return None
 
         return await asyncio.to_thread(_get_cover_art)