Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Subsonic: Allow user to force player provider seek #1798

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading