backup image for library artists

This commit is contained in:
Broque Thomas 2026-02-18 17:27:01 -08:00
parent 7b6e94772e
commit e2351eaa5c
2 changed files with 11 additions and 4 deletions

View file

@ -4318,13 +4318,14 @@ class MusicDatabase:
a.musicbrainz_id, a.musicbrainz_id,
a.spotify_artist_id, a.spotify_artist_id,
a.itunes_artist_id, a.itunes_artist_id,
a.deezer_id,
COUNT(DISTINCT al.id) as album_count, COUNT(DISTINCT al.id) as album_count,
COUNT(DISTINCT t.id) as track_count COUNT(DISTINCT t.id) as track_count
FROM artists a FROM artists a
LEFT JOIN albums al ON a.id = al.artist_id LEFT JOIN albums al ON a.id = al.artist_id
LEFT JOIN tracks t ON al.id = t.album_id LEFT JOIN tracks t ON al.id = t.album_id
WHERE {where_clause} 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 ORDER BY a.name COLLATE NOCASE
LIMIT ? OFFSET ? LIMIT ? OFFSET ?
""" """
@ -4369,6 +4370,7 @@ class MusicDatabase:
'image_url': artist.thumb_url, 'image_url': artist.thumb_url,
'genres': artist.genres, 'genres': artist.genres,
'musicbrainz_id': row['musicbrainz_id'], 'musicbrainz_id': row['musicbrainz_id'],
'deezer_id': row['deezer_id'],
'album_count': row['album_count'] or 0, 'album_count': row['album_count'] or 0,
'track_count': row['track_count'] or 0, 'track_count': row['track_count'] or 0,
'is_watched': bool(is_watched) 'is_watched': bool(is_watched)

View file

@ -25649,9 +25649,14 @@ function createLibraryArtistCard(artist) {
img.alt = artist.name; img.alt = artist.name;
img.loading = 'lazy'; img.loading = 'lazy';
img.onerror = () => { img.onerror = () => {
console.log(`Failed to load image for ${artist.name}: ${artist.image_url}`); console.log(`Failed to load image for ${artist.name}: ${img.src}`);
// Replace with fallback on error // Try Deezer fallback before emoji
imageContainer.innerHTML = `<div class="library-artist-image-fallback">🎵</div>`; 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 = `<div class="library-artist-image-fallback">🎵</div>`;
}
}; };
img.onload = () => { img.onload = () => {
console.log(`Successfully loaded image for ${artist.name}: ${artist.image_url}`); console.log(`Successfully loaded image for ${artist.name}: ${artist.image_url}`);