From: Eric Munson Date: Wed, 4 Dec 2024 13:01:18 +0000 (-0500) Subject: fix: Subsonic: Allow user to force player provider seek (#1798) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=10e13786601d84c6d1e89b458899861f0e8f1296;p=music-assistant-server.git fix: Subsonic: Allow user to force player provider seek (#1798) --- diff --git a/music_assistant/providers/opensubsonic/__init__.py b/music_assistant/providers/opensubsonic/__init__.py index 47e05ac5..e1d26744 100644 --- a/music_assistant/providers/opensubsonic/__init__.py +++ b/music_assistant/providers/opensubsonic/__init__.py @@ -13,6 +13,7 @@ from .sonic_provider import ( CONF_BASE_URL, CONF_ENABLE_LEGACY_AUTH, CONF_ENABLE_PODCASTS, + CONF_OVERRIDE_OFFSET, OpenSonicProvider, ) @@ -90,4 +91,13 @@ async def get_config_entries( description='Enable OpenSubsonic "legacy" auth support', default_value=False, ), + ConfigEntry( + key=CONF_OVERRIDE_OFFSET, + type=ConfigEntryType.BOOLEAN, + label="Force player provider seek", + required=True, + description="Some Subsonic implementations advertise that they support seeking when " + "they do not always. If seeking does not work for you, enable this.", + default_value=False, + ), ) diff --git a/music_assistant/providers/opensubsonic/sonic_provider.py b/music_assistant/providers/opensubsonic/sonic_provider.py index 28c877aa..62ef89de 100644 --- a/music_assistant/providers/opensubsonic/sonic_provider.py +++ b/music_assistant/providers/opensubsonic/sonic_provider.py @@ -56,6 +56,7 @@ if TYPE_CHECKING: CONF_BASE_URL = "baseURL" CONF_ENABLE_PODCASTS = "enable_podcasts" CONF_ENABLE_LEGACY_AUTH = "enable_legacy_auth" +CONF_OVERRIDE_OFFSET = "override_transcode_offest" UNKNOWN_ARTIST_ID = "fake_artist_unknown" @@ -71,6 +72,7 @@ class OpenSonicProvider(MusicProvider): _conn: SonicConnection = None _enable_podcasts: bool = True _seek_support: bool = False + _ignore_offset: bool = False async def handle_async_init(self) -> None: """Set up the music provider and test the connection.""" @@ -101,11 +103,12 @@ class OpenSonicProvider(MusicProvider): ) raise LoginFailed(msg) from e self._enable_podcasts = self.config.get_value(CONF_ENABLE_PODCASTS) + self._ignore_offset = self.config.get_value(CONF_OVERRIDE_OFFSET) try: ret = await self._run_async(self._conn.getOpenSubsonicExtensions) extensions = ret["openSubsonicExtensions"] for entry in extensions: - if entry["name"] == "transcodeOffset": + if entry["name"] == "transcodeOffset" and not self._ignore_offset: self._seek_support = True break except OSError: