feat: disambiguate same-name artists by Deezer fan count + show fans
Deezer's artist search doesn't rank by popularity, so a name collision (5 artists named "Joji") returned a niche one first (62 fans) instead of the real Joji (559k) — the artist page then loaded the wrong discography and owned songs didn't show as downloaded. - api.js: _dzArtist carries fanCount (nb_fan); artist search sorts by fanCount desc. - search.js: artist cards show the fan count as subtitle; fan count passed to the artist page. - detail.js: pick the most-popular name match (not the first); for local Navidrome artists with a real collision (>=2 same-name candidates), tie-break by SONG OVERLAP — prefer the Deezer candidate whose top tracks actually overlap the library (each artist has different songs, so this nails the right person). Costs a few calls only on a collision. - Artist hero shows "<n> Fans" (immediately for global-search artists, after match for local). - Android: DzArtist.nb_fan + /search/artist sorted by nb_fan so the right artist is first. - Also: web global-search "unavailable" message now says Deezer, not Apple. SW ns-v52. Verified live against Deezer: both fan-sort and overlap select the real Joji (id 5078097). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e69831dd8
commit
065d2f7319
9 files changed
+69
-19
No files matched your search
+6
-1
@@ -305,6 +305,9 @@ function _dzArtist(a) {
|
||||
wrapperType: 'artist',
|
||||
artistId: a.id, artistName: a.name,
|
||||
artworkUrl100: a.picture_big || a.picture_medium || '',
|
||||
// Deezer's artist search does NOT rank by popularity — several artists can share a name
|
||||
// (5× "Joji"). fanCount lets us pick the one the user means (see itunesSearch + detail.js).
|
||||
fanCount: a.nb_fan ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -323,7 +326,9 @@ export async function itunesSearch(query, entity='musicTrack', limit=25) {
|
||||
const txt = await r.text();
|
||||
const data = (txt ? JSON.parse(txt) : {}).data || [];
|
||||
if (entity === 'album') return data.map(_dzAlbum);
|
||||
if (entity === 'musicArtist') return data.map(_dzArtist);
|
||||
// Sort artists by popularity so a name collision resolves to the artist the user means
|
||||
// (Deezer returns them in an unhelpful order — the real "Joji" isn't first).
|
||||
if (entity === 'musicArtist') return data.map(_dzArtist).sort((x, y) => (y.fanCount || 0) - (x.fanCount || 0));
|
||||
return data.map(_dzTrack);
|
||||
} catch { _itunesLastError = 'network'; return []; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user