Skip to content
Merged
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
20 changes: 19 additions & 1 deletion music_assistant/providers/opensubsonic/sonic_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from datetime import datetime
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar

from aiohttp import ClientResponseError
from libopensonic import AsyncConnection as SonicConnection
from libopensonic import Extensions as OpenSubsonicExtensions
from libopensonic.errors import (
Expand Down Expand Up @@ -122,6 +123,7 @@ async def get_config_entries(self) -> tuple[ConfigEntry, ...]:
key=CONF_ENABLE_PODCASTS,
type=ConfigEntryType.BOOLEAN,
required=True,
hidden=True,
default_value=True,
),
ConfigEntry(
Expand Down Expand Up @@ -242,7 +244,23 @@ async def handle_async_init(self) -> None:
except OSError:
self.logger.info("Failed to query server for OpenSubsonic extensions")

self._enable_podcasts = bool(self.config.get_value(CONF_ENABLE_PODCASTS))
# Migration from the old subsonic config for enabling podcasts + the generic library sync option
# to a only using the library sync (plus probing a podcast endpoint)
# After this code has gone out in a release which marks the podcast option
# as not visible, we will drop that config option entirely and set
# _enable_podcasts to the result of the probe

can_podcast = False
if bool(self.config.get_value("library_sync_podcasts")):
try:
await self.conn.get_podcasts(inc_episodes=False)
can_podcast = True
except SonicError:
self.logger.info("Server does not support podcasts, disabling")
except ClientResponseError:
self.logger.info("Server does not support podcasts, disabling")
Comment thread
khers marked this conversation as resolved.

self._enable_podcasts = bool(self.config.get_value(CONF_ENABLE_PODCASTS)) and can_podcast
Comment thread
khers marked this conversation as resolved.
self._enable_radio_stations = bool(self.config.get_value(CONF_ENABLE_RADIO_STATIONS))
self._show_faves = bool(self.config.get_value(CONF_RECO_FAVES))
self._show_new = bool(self.config.get_value(CONF_NEW_ALBUMS))
Expand Down
Loading