Fix album track lookup hardcoded to Spotify on Artists page

The /api/artist/{id}/album/{id}/tracks endpoint was hardcoded to use
spotify_client and returned 401 if Spotify wasn't authenticated,
even when the user's primary source was Deezer or iTunes. Now uses
the configured primary metadata source via _get_metadata_fallback_client
with Spotify as fallback. Also gives a clearer error message when
no metadata source is available at all.
pull/339/head
Broque Thomas 4 weeks ago
parent 908924d22c
commit 2f2e5ddbd0

@ -11602,12 +11602,9 @@ def get_artist_album_tracks(artist_id, album_id):
except Exception as e:
logger.warning(f"Hydrabase album_tracks failed for '{album_id}', falling back to Spotify: {e}")
if not spotify_client or not spotify_client.is_authenticated():
return jsonify({"error": "Spotify not authenticated"}), 401
# Source override: when user navigated from a specific search tab
source_override = request.args.get('source', '')
client = spotify_client
client = None
if source_override == 'itunes':
client = _get_itunes_client()
elif source_override == 'hydrabase':
@ -11621,6 +11618,18 @@ def get_artist_album_tracks(artist_id, album_id):
elif source_override == 'discogs':
client = _get_discogs_client()
# No source override — use the primary metadata source
if not client:
try:
client = _get_metadata_fallback_client()
except Exception:
pass
# Fall back to Spotify if available
if not client and spotify_client and spotify_client.is_authenticated():
client = spotify_client
if not client:
return jsonify({"error": "No metadata source available. Configure Spotify, Deezer, or iTunes in Settings."}), 401
logger.debug(
"Fetching tracks for album %s by artist %s (source=%s)",
album_id,
@ -22626,6 +22635,7 @@ def get_version_info():
"• Fix library page crash on All filter — non-string soul_id broke card rendering",
"• Auto Wing It fallback for failed discovery — unmatched tracks download via Soulseek with raw metadata",
"• Lidarr download source now production-ready — full orchestrator integration",
"• Fix album track lookup hardcoded to Spotify — now uses configured primary source",
"• Fix M3U showing all tracks as missing — regenerate with real paths after post-processing",
"• Fix AcoustID retag not writing corrected tags to audio file",
"• Fix wishlist albums cycle stuck at 1 concurrent worker instead of configured value",

@ -3603,6 +3603,7 @@ const WHATS_NEW = {
// --- April 19, 2026 ---
{ date: 'April 19, 2026' },
{ title: 'Fix Wishlist Albums Cycle Stuck at 1 Concurrent', desc: 'Auto-wishlist processing during the "albums" cycle was limited to 1 concurrent download even with higher configured settings. The max_concurrent=1 restriction is only needed for Soulseek folder-based album grabs, not individual wishlist track downloads. Albums cycle now uses the configured concurrency like singles' },
{ title: 'Fix Album Track Lookup Hardcoded to Spotify', desc: 'Clicking an album on the Artists page to download tracks was hardcoded to use Spotify even when the user\'s primary metadata source was Deezer or iTunes. Now uses the configured primary source with Spotify as fallback' },
{ title: 'Fix Wishlist Splitting Albums by Track Artist', desc: 'Adding a multi-artist album (like a soundtrack) to wishlist was creating separate entries per track artist instead of keeping all tracks under the album artist. Now uses the album-level artist context when available to keep tracks grouped correctly' },
{ title: 'Fix Artist Search Case Sensitivity', desc: 'Artist search on the Artists page now normalizes all-lowercase queries to title case before hitting metadata APIs. Some APIs return fewer or no results for lowercase queries like "foreigner" vs "Foreigner"' },
{ title: 'Lidarr Download Source Now Production-Ready', desc: 'Lidarr is now a fully functional download source with complete orchestrator integration. Downloads appear in the UI, status polling works, cancellation works, and cleanup on shutdown works. Error messages are now visible in the download list. Removed "(Development)" label' },

Loading…
Cancel
Save