From: Eric Munson Date: Sat, 8 Mar 2025 23:51:18 +0000 (-0500) Subject: Fix Subsonic: Use transcode metadata when present (#2011) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=f31ce187558d18d41bd696a99ff385ab5f985a84;p=music-assistant-server.git Fix Subsonic: Use transcode metadata when present (#2011) Use transcode metadata when present When transcoding, a server should fill out the transcode_content_type field when metadata for a track is requested. If this field is present we need to use it instead of the on disk format. Fixes: https://github.com/music-assistant/support/issues/3586 Signed-off-by: Eric B Munson --- diff --git a/music_assistant/providers/opensubsonic/manifest.json b/music_assistant/providers/opensubsonic/manifest.json index fda0aa2a..cb868c1c 100644 --- a/music_assistant/providers/opensubsonic/manifest.json +++ b/music_assistant/providers/opensubsonic/manifest.json @@ -7,7 +7,7 @@ "@khers" ], "requirements": [ - "py-opensonic==5.2.1" + "py-opensonic==5.3.0" ], "documentation": "https://music-assistant.io/music-providers/subsonic/", "multi_instance": true diff --git a/music_assistant/providers/opensubsonic/sonic_provider.py b/music_assistant/providers/opensubsonic/sonic_provider.py index 620ac827..ccaae114 100644 --- a/music_assistant/providers/opensubsonic/sonic_provider.py +++ b/music_assistant/providers/opensubsonic/sonic_provider.py @@ -746,15 +746,21 @@ class OpenSonicProvider(MusicProvider): msg = f"Item {item_id} not found" raise MediaNotFoundError(msg) from e + if item.transcoded_content_type: + mime_type = item.transcoded_content_type + else: + mime_type = item.content_type + self.logger.debug( "Fetching stream details for id %s '%s' with format '%s'", item.id, item.title, - item.content_type, + mime_type, ) elif media_type == MediaType.PODCAST_EPISODE: item = await self._get_podcast_episode(item_id) + mime_type = item.content_type self.logger.debug( "Fetching stream details for podcast episode '%s' with format '%s'", @@ -765,7 +771,6 @@ class OpenSonicProvider(MusicProvider): msg = f"Unsupported media type encountered '{media_type}'" raise UnsupportedFeaturedException(msg) - mime_type = item.content_type # For mp4 or m4a files, better to let ffmpeg detect the codec in use so mark them unknown if mime_type.endswith("mp4"): self.logger.warning( diff --git a/requirements_all.txt b/requirements_all.txt index abbfbd84..e6939811 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -33,7 +33,7 @@ pillow==11.1.0 pkce==1.0.3 plexapi==4.16.1 podcastparser==0.6.10 -py-opensonic==5.2.1 +py-opensonic==5.3.0 pyblu==2.0.0 PyChromecast==14.0.5 pycryptodome==3.21.0