fix: Subsonic: Allow user to force player provider seek (#1798)
authorEric Munson <eric@munsonfam.org>
Wed, 4 Dec 2024 13:01:18 +0000 (08:01 -0500)
committerGitHub <noreply@github.com>
Wed, 4 Dec 2024 13:01:18 +0000 (14:01 +0100)
music_assistant/providers/opensubsonic/__init__.py
music_assistant/providers/opensubsonic/sonic_provider.py

index 47e05ac5b65f1c5a54f5fdc43936752fa75da159..e1d267447eb4b28ef7613faecb1afb7ef4060d81 100644 (file)
@@ -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,
+        ),
     )
index 28c877aae39f707f8bab28bc4eba6fbc36372edb..62ef89decbfae4b451ea9a19dbd2e84fa89c075d 100644 (file)
@@ -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: