fix(artist pin): apply pins in search + fix similar artists (web + android)
Two gaps the pin left, on both platforms: 1. Search still showed the wrong same-name artist's photo. The library search now prefers the pin's Deezer picture for a pinned artist (web: search.js artist cards; android: LibrarySearchContent via SearchViewModel overrides). 2. Similar Artists were "weird" — they come from Last.fm keyed to the (merged/ wrong) Navidrome artist. When pinned, use Deezer "related" of the pinned artist instead (new deezerRelatedArtists / ItunesClient.lookupRelatedArtists). Also: web Similar Artists now render with profile pictures (avatar chips), like the Android app, instead of plain text chips. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
1ee85482f3
commit
26de85a140
9 files changed
+116
-20
No files matched your search
+29
-8
@@ -1,6 +1,6 @@
|
||||
import { S } from '../state.js';
|
||||
import { esc, toast, fmtCount } from '../utils.js';
|
||||
import { api, coverUrl, deezerSearch, deezerLookupAlbum, deezerLookupArtistSongs, deezerLookupArtistAlbums, deezerArtistImage, fetchRomajiIndex, dispArtistById, dispAlbumName, cacheArtistSortNames, ensureArtistSortMap, getArtistOverride } from '../api.js';
|
||||
import { api, coverUrl, deezerSearch, deezerLookupAlbum, deezerLookupArtistSongs, deezerLookupArtistAlbums, deezerArtistImage, deezerRelatedArtists, fetchRomajiIndex, dispArtistById, dispAlbumName, cacheArtistSortNames, ensureArtistSortMap, getArtistOverride } from '../api.js';
|
||||
import { openArtistPin } from '../ui/artistPin.js';
|
||||
import { makeCard, makeAlbumCard, makeGlobalTrackItem, makeSongItem } from '../ui/components.js';
|
||||
import { playQueue, dlSongLocal, toggleStar, parseArtists } from '../player/player.js';
|
||||
@@ -230,13 +230,34 @@ export async function loadArtistDetail(artist) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Similar artists ──
|
||||
const similar = info?.similarArtist || [];
|
||||
if(similar.length && simEl) {
|
||||
simEl.innerHTML = `<div class="section-title" style="margin-bottom:10px">Ähnliche Künstler</div>
|
||||
<div class="similar-chips">${similar.map(a =>
|
||||
`<span class="similar-chip" onclick="navigate('artist-detail',{id:'${esc(a.id||a.name)}',name:'${esc(a.name)}'})">
|
||||
${esc(a.name)}</span>`).join('')}</div>`;
|
||||
// ── Similar artists (with profile pictures) ──
|
||||
// When pinned, use Deezer "related" for the pinned artist — Last.fm's list is keyed to the
|
||||
// (possibly merged/wrong) Navidrome artist, so it goes "weird". Deezer related carry real photos.
|
||||
if (simEl) {
|
||||
let simList;
|
||||
if (_pin?.deezerArtistId) {
|
||||
const rel = await deezerRelatedArtists(_pin.deezerArtistId, 12);
|
||||
simList = rel.map(r => ({
|
||||
name: r.artistName, img: r.artworkUrl100 || '',
|
||||
nav: { id: null, name: r.artistName, deezerArtistId: r.artistId, deezerFanCount: r.fanCount ?? null },
|
||||
}));
|
||||
} else {
|
||||
simList = (info?.similarArtist || []).map(a => ({
|
||||
name: a.name, img: coverUrl(a.coverArt || a.id, 160) || '',
|
||||
nav: { id: a.id || a.name, name: a.name },
|
||||
}));
|
||||
}
|
||||
if (simList.length) {
|
||||
const _navAttr = n => esc(JSON.stringify(n)).replace(/"/g, '"');
|
||||
simEl.innerHTML = `<div class="section-title" style="margin-bottom:10px">Ähnliche Künstler</div>
|
||||
<div class="scroll-row">${simList.map(a => `
|
||||
<div class="artist-card" style="cursor:pointer;width:88px" onclick='navigate("artist-detail", ${_navAttr(a.nav)})'>
|
||||
<div class="card-art" style="width:88px;height:88px;border-radius:50%;overflow:hidden">
|
||||
${a.img ? `<img src="${esc(a.img)}" loading="lazy" style="width:100%;height:100%;object-fit:cover" onerror="this.parentNode.innerHTML='<div class=\\'no-art\\'>🎤</div>'">` : `<div class="no-art">🎤</div>`}
|
||||
</div>
|
||||
<div class="card-title" style="text-align:center;font-size:12px;margin-top:6px">${esc(a.name)}</div>
|
||||
</div>`).join('')}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Top Songs ──
|
||||
|
||||
Reference in new issue
Block a user