feat: Deezer artist photo fallback for local artists with no Navidrome image
Niche local artists (e.g. N!GHT) whose Navidrome metadata agents have no image showed a blank hero. Now, when Navidrome has no artist image, the hero falls back to the matched Deezer artist's photo (Navidrome image → Deezer photo → album cover), on web + Android. - Web (detail.js): the Deezer-photo fallback previously ran only for non-local artists; now it runs whenever the Navidrome image is absent, local or not. - Android: ArtistViewModel captures the matched Deezer artist's photo (deezerImage); ArtistDetailScreen uses it as the hero fallback. SW ns-v56. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
640e475c51
commit
569af968c5
5 files changed
+26
-12
No files matched your search
+15
-10
@@ -178,16 +178,21 @@ export async function loadArtistDetail(artist) {
|
||||
const itunesArtistId = knownItunes ?? iArtistMatch?.artistId ?? null;
|
||||
if (!knownFans) _showFans(iArtistMatch?.fanCount); // local artist: show the matched Deezer artist's fans
|
||||
|
||||
// Non-local (Deezer) artist has no Navidrome photo — fetch the Deezer artist picture for the hero.
|
||||
if (!hasND && itunesArtistId && pfpWrap) {
|
||||
const dzImg = iArtistMatch?.artworkUrl100 || await deezerArtistImage(itunesArtistId);
|
||||
if (dzImg) {
|
||||
const pfpImg = document.createElement('img');
|
||||
pfpImg.className = 'artist-hero-pfp';
|
||||
pfpImg.onload = pfpImg.onerror = () => { if (bgEl) bgEl.style.backgroundImage = `url('${dzImg}')`; _revealHero(); };
|
||||
pfpImg.src = dzImg;
|
||||
pfpWrap.prepend(pfpImg);
|
||||
document.getElementById('artist-hero-pfp-initial')?.style.setProperty('display', 'none');
|
||||
// Artist photo: Navidrome (from its metadata agents) first; if it has none, fall back to the
|
||||
// matched Deezer artist's picture. Covers non-local Deezer artists AND niche local artists
|
||||
// (e.g. N!GHT) that Navidrome's agents have no art for — the hero was blank for those before.
|
||||
if (itunesArtistId && pfpWrap) {
|
||||
const ndImg = await imgP.catch(() => null);
|
||||
if (!ndImg) {
|
||||
const dzImg = iArtistMatch?.artworkUrl100 || await deezerArtistImage(itunesArtistId);
|
||||
if (dzImg) {
|
||||
const pfpImg = document.createElement('img');
|
||||
pfpImg.className = 'artist-hero-pfp';
|
||||
pfpImg.onload = pfpImg.onerror = () => { if (bgEl) bgEl.style.backgroundImage = `url('${dzImg}')`; _revealHero(); };
|
||||
pfpImg.src = dzImg;
|
||||
pfpWrap.prepend(pfpImg);
|
||||
document.getElementById('artist-hero-pfp-initial')?.style.setProperty('display', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user