From 4cf18ad2c929e419b40b59e9d3d4dadd9851847d Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Mon, 13 Apr 2026 14:50:49 -0700 Subject: [PATCH] Fix service status not showing Spotify as active metadata source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The status cache's source field was being set by _get_metadata_fallback_source(), which internally calls is_spotify_authenticated() a second time via module import. Any inconsistency between that path and the direct auth check already performed would return 'deezer', poisoning the cache — and since the WebSocket takes over from the HTTP poll, it never corrected itself. Now reads config directly and reuses the single auth probe result. --- web_server.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/web_server.py b/web_server.py index 4e49c4dd..62f471e8 100644 --- a/web_server.py +++ b/web_server.py @@ -4688,22 +4688,23 @@ def get_status(): rate_limit_info = spotify_client.get_rate_limit_info() if (spotify_client and is_rate_limited) else None cooldown_remaining = spotify_client.get_post_ban_cooldown_remaining() if spotify_client else 0 + # Read configured source once — no auth validation here, we do that explicitly below + configured_source = config_manager.get('metadata.fallback_source', 'deezer') or 'deezer' + if is_rate_limited or cooldown_remaining > 0: # During rate limit or post-ban cooldown, skip the auth probe entirely. # Probing Spotify here would reset the rate limit timer. - music_source = _get_metadata_fallback_source() - if music_source == 'spotify': - music_source = 'deezer' # Spotify rate limited — can't use it + music_source = 'deezer' if configured_source == 'spotify' else configured_source spotify_response_time = 0 else: spotify_start = time.time() spotify_connected = spotify_client.is_spotify_authenticated() if spotify_client else False spotify_response_time = (time.time() - spotify_start) * 1000 - # Use whatever the user configured as primary metadata source - music_source = _get_metadata_fallback_source() - # If user selected spotify but it's not authed, fall back - if music_source == 'spotify' and not spotify_connected: - music_source = 'deezer' + # Use configured source; fall back to deezer only if Spotify isn't authenticated + if configured_source == 'spotify': + music_source = 'spotify' if spotify_connected else 'deezer' + else: + music_source = configured_source _status_cache['spotify'] = { 'connected': True, # Always true — iTunes fallback is always available