From: Jozef Kruszynski <60214390+jozefKruszynski@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:29:16 +0000 (+0200) Subject: tidal: allow audio quality switching after authentication (#2144) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=de56fce0857ba52cbe7204f34aa9a60618a9c89a;p=music-assistant-server.git tidal: allow audio quality switching after authentication (#2144) --- diff --git a/music_assistant/providers/tidal/__init__.py b/music_assistant/providers/tidal/__init__.py index a679d63b..70912b19 100644 --- a/music_assistant/providers/tidal/__init__.py +++ b/music_assistant/providers/tidal/__init__.py @@ -8,7 +8,6 @@ import json from collections.abc import Awaitable, Callable from contextlib import suppress from datetime import datetime -from enum import StrEnum from typing import TYPE_CHECKING, Any, TypeVar, cast from aiohttp import ClientConnectionError, ClientResponse @@ -101,13 +100,6 @@ DEFAULT_LIMIT = 50 T = TypeVar("T") -class TidalQualityEnum(StrEnum): - """Enum for Tidal Quality.""" - - HIGH_LOSSLESS = "LOSSLESS" # "High - 16bit, 44.1kHz" - HI_RES = "HI_RES_LOSSLESS" # "Max - Up to 24bit, 192kHz" - - async def setup( mass: MusicAssistant, manifest: ProviderManifest, config: ProviderConfig ) -> ProviderInstanceType: @@ -180,13 +172,13 @@ async def get_config_entries( ConfigEntry( key=CONF_QUALITY, type=ConfigEntryType.STRING, - label=CONF_QUALITY, - required=True, - hidden=True, - value=cast("str", values.get(CONF_QUALITY) or TidalQualityEnum.HI_RES.value), - default_value=cast( - "str", values.get(CONF_QUALITY) or TidalQualityEnum.HI_RES.value - ), + label="Quality setting for Tidal:", + description="High = 16bit 44.1kHz\n\nMax = Up to 24bit 192kHz", + options=[ + ConfigValueOption("High", "LOSSLESS"), + ConfigValueOption("Max", "HI_RES_LOSSLESS"), + ], + default_value="HI_RES_LOSSLESS", ), ) else: @@ -196,10 +188,12 @@ async def get_config_entries( type=ConfigEntryType.STRING, label="Quality setting for Tidal:", required=True, - description="HIGH_LOSSLESS = 16bit 44.1kHz, HI_RES = Up to 24bit 192kHz", - options=[ConfigValueOption(x.value, x.name) for x in TidalQualityEnum], - default_value=TidalQualityEnum.HI_RES.value, - value=cast("str", values.get(CONF_QUALITY)) if values else None, + description="High = 16bit 44.1kHz\n\nMax = Up to 24bit 192kHz", + options=[ + ConfigValueOption("High", "LOSSLESS"), + ConfigValueOption("Max", "HI_RES_LOSSLESS"), + ], + default_value="HI_RES_LOSSLESS", ), ConfigEntry( key=LABEL_START_PKCE_LOGIN,