From e2351eaa5cb675e9b71a018d95503861c659370a Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Wed, 18 Feb 2026 17:27:01 -0800 Subject: [PATCH] backup image for library artists --- database/music_database.py | 4 +++- webui/static/script.js | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/database/music_database.py b/database/music_database.py index 243fc6b1..5f916855 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -4318,13 +4318,14 @@ class MusicDatabase: a.musicbrainz_id, a.spotify_artist_id, a.itunes_artist_id, + a.deezer_id, COUNT(DISTINCT al.id) as album_count, COUNT(DISTINCT t.id) as track_count FROM artists a LEFT JOIN albums al ON a.id = al.artist_id LEFT JOIN tracks t ON al.id = t.album_id WHERE {where_clause} - GROUP BY a.id, a.name, a.thumb_url, a.genres, a.musicbrainz_id + GROUP BY a.id, a.name, a.thumb_url, a.genres, a.musicbrainz_id, a.deezer_id ORDER BY a.name COLLATE NOCASE LIMIT ? OFFSET ? """ @@ -4369,6 +4370,7 @@ class MusicDatabase: 'image_url': artist.thumb_url, 'genres': artist.genres, 'musicbrainz_id': row['musicbrainz_id'], + 'deezer_id': row['deezer_id'], 'album_count': row['album_count'] or 0, 'track_count': row['track_count'] or 0, 'is_watched': bool(is_watched) diff --git a/webui/static/script.js b/webui/static/script.js index 57d8e39b..43ac560c 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -25649,9 +25649,14 @@ function createLibraryArtistCard(artist) { img.alt = artist.name; img.loading = 'lazy'; img.onerror = () => { - console.log(`Failed to load image for ${artist.name}: ${artist.image_url}`); - // Replace with fallback on error - imageContainer.innerHTML = `
🎵
`; + console.log(`Failed to load image for ${artist.name}: ${img.src}`); + // Try Deezer fallback before emoji + if (artist.deezer_id && !img.dataset.triedDeezer) { + img.dataset.triedDeezer = 'true'; + img.src = `https://api.deezer.com/artist/${artist.deezer_id}/image?size=big`; + } else { + imageContainer.innerHTML = `
🎵
`; + } }; img.onload = () => { console.log(`Successfully loaded image for ${artist.name}: ${artist.image_url}`);