Skip to content

Commit

Permalink
fix: Subsonic: Allow user to force player provider seek (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
khers authored Dec 4, 2024
1 parent dd79d90 commit 10e1378
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions music_assistant/providers/opensubsonic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CONF_BASE_URL,
CONF_ENABLE_LEGACY_AUTH,
CONF_ENABLE_PODCASTS,
CONF_OVERRIDE_OFFSET,
OpenSonicProvider,
)

Expand Down Expand Up @@ -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,
),
)
5 changes: 4 additions & 1 deletion music_assistant/providers/opensubsonic/sonic_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
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"

Expand All @@ -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."""
Expand Down Expand Up @@ -101,11 +103,12 @@ async def handle_async_init(self) -> None:
)
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:
Expand Down

0 comments on commit 10e1378

Please sign in to comment.