diff --git a/core/spotify_worker.py b/core/spotify_worker.py index 81b70a5b..5ff381d5 100644 --- a/core/spotify_worker.py +++ b/core/spotify_worker.py @@ -124,9 +124,12 @@ class SpotifyWorker: # Auth guard — don't process anything without Spotify auth if not self.client.is_spotify_authenticated(): - logger.debug("Spotify not authenticated, sleeping 30s...") - time.sleep(30) - continue + # Try reloading config in case user re-authenticated via settings + self.client.reload_config() + if not self.client.is_spotify_authenticated(): + logger.debug("Spotify not authenticated, sleeping 30s...") + time.sleep(30) + continue self.current_item = None item = self._get_next_item() diff --git a/web_server.py b/web_server.py index 94235b56..47576d6a 100644 --- a/web_server.py +++ b/web_server.py @@ -3685,6 +3685,9 @@ def spotify_callback(): if spotify_client.is_authenticated(): # Invalidate status cache so next poll picks up the new connection _status_cache_timestamps['spotify'] = 0 + # Refresh enrichment worker's client so it picks up new auth + if spotify_enrichment_worker and hasattr(spotify_enrichment_worker, 'client'): + spotify_enrichment_worker.client.reload_config() add_activity_item("✅", "Spotify Auth Complete", "Successfully authenticated with Spotify", "Now") return "
You can close this window.
" else: @@ -28322,6 +28325,9 @@ def start_oauth_callback_servers(): if spotify_client.is_authenticated(): # Invalidate status cache so next poll picks up the new connection _status_cache_timestamps['spotify'] = 0 + # Refresh enrichment worker's client so it picks up new auth + if spotify_enrichment_worker and hasattr(spotify_enrichment_worker, 'client'): + spotify_enrichment_worker.client.reload_config() add_activity_item("✅", "Spotify Auth Complete", "Successfully authenticated with Spotify", "Now") self.send_response(200) self.send_header('Content-type', 'text/html') diff --git a/webui/static/script.js b/webui/static/script.js index 397f1ad0..44254801 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -40211,14 +40211,14 @@ function updateSpotifyEnrichmentStatusFromData(data) { const notAuthenticated = data.authenticated === false; button.classList.remove('active', 'paused', 'complete', 'no-auth'); - if (notAuthenticated) { + if (data.paused) { + button.classList.add('paused'); + } else if (notAuthenticated) { button.classList.add('no-auth'); } else if (data.idle) { button.classList.add('complete'); } else if (data.running && !data.paused) { button.classList.add('active'); - } else if (data.paused) { - button.classList.add('paused'); } const tooltipStatus = document.getElementById('spotify-enrich-tooltip-status'); @@ -40226,15 +40226,17 @@ function updateSpotifyEnrichmentStatusFromData(data) { const tooltipProgress = document.getElementById('spotify-enrich-tooltip-progress'); if (tooltipStatus) { - if (notAuthenticated) { tooltipStatus.textContent = 'Not Authenticated'; } + if (data.paused) { tooltipStatus.textContent = 'Paused'; } + else if (notAuthenticated) { tooltipStatus.textContent = 'Not Authenticated'; } else if (data.idle) { tooltipStatus.textContent = 'Complete'; } - else if (data.running && !data.paused) { tooltipStatus.textContent = 'Running'; } - else if (data.paused) { tooltipStatus.textContent = 'Paused'; } + else if (data.running) { tooltipStatus.textContent = 'Running'; } else { tooltipStatus.textContent = 'Idle'; } } if (tooltipCurrent) { - if (notAuthenticated) { + if (data.paused) { + tooltipCurrent.textContent = notAuthenticated ? 'Connect Spotify in Settings to enrich' : 'Click to resume'; + } else if (notAuthenticated) { tooltipCurrent.textContent = 'Connect Spotify in Settings to enrich'; } else if (data.idle) { tooltipCurrent.textContent = 'All items processed';