From: Eric Munson Date: Sun, 28 Jan 2024 21:46:48 +0000 (-0500) Subject: Subsonic: Support track enumeration on older Navidrome servers (#1037) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=dfbef058bb461e348369fdb20e7d2a86b1bb375d;p=music-assistant-server.git Subsonic: Support track enumeration on older Navidrome servers (#1037) --- diff --git a/music_assistant/server/providers/opensubsonic/sonic_provider.py b/music_assistant/server/providers/opensubsonic/sonic_provider.py index 00a7bc8a..0f862cd5 100644 --- a/music_assistant/server/providers/opensubsonic/sonic_provider.py +++ b/music_assistant/server/providers/opensubsonic/sonic_provider.py @@ -453,23 +453,36 @@ class OpenSonicProvider(MusicProvider): Note the lack of item count on this method. """ + query = "" offset = 0 count = 500 - results = await self._run_async( - self._conn.search3, - query="", - artistCount=0, - albumCount=0, - songOffset=offset, - songCount=count, - ) + try: + results = await self._run_async( + self._conn.search3, + query=query, + artistCount=0, + albumCount=0, + songOffset=offset, + songCount=count, + ) + except ParameterError: + # Older Navidrome does not accept an empty string and requires the empty quotes + query = '""' + results = await self._run_async( + self._conn.search3, + query=query, + artistCount=0, + albumCount=0, + songOffset=offset, + songCount=count, + ) while results["songs"]: for entry in results["songs"]: yield self._parse_track(entry) offset += count results = await self._run_async( self._conn.search3, - query="", + query=query, artistCount=0, albumCount=0, songOffset=offset,