From 276fcac157230c89b72a9e1b68097e990a332497 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 24 Jan 2024 12:07:50 +0100 Subject: [PATCH] Fix blocking IO in subsonic provider --- .../server/providers/opensubsonic/sonic_provider.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/music_assistant/server/providers/opensubsonic/sonic_provider.py b/music_assistant/server/providers/opensubsonic/sonic_provider.py index 4e8e5bb5..bd3c14bf 100644 --- a/music_assistant/server/providers/opensubsonic/sonic_provider.py +++ b/music_assistant/server/providers/opensubsonic/sonic_provider.py @@ -315,10 +315,14 @@ class OpenSonicProvider(MusicProvider): async def _run_async(self, call: Callable, *args, **kwargs): return await self.mass.create_task(call, *args, **kwargs) - async def resolve_image(self, path: str) -> str | bytes | AsyncGenerator[bytes, None]: + async def resolve_image(self, path: str) -> bytes: """Return the image.""" - with self._conn.getCoverArt(path) as art: - return art.content + + def _get_cover_art() -> bytes: + with self._conn.getCoverArt(path) as art: + return art.content + + await asyncio.to_thread(_get_cover_art) async def search( self, search_query: str, media_types: list[MediaType] | None = None, limit: int = 20 -- 2.34.1