fix: album shown 2-3x in "In Library" on the artist page
Deezer returns the same album as several variants (single/EP/album/regional/explicit), and
each variant matched the same Navidrome album, so one owned album rendered 2-3 times
("PIXELATED KISSES" x3).
- Web (detail.js): collapse matched entries to one per owned Navidrome album and one per
not-owned title before classifying (also avoids duplicate track-count fetches).
- Android (categorizeAlbums): distinctBy(collectionId) missed variants with different ids;
now also skip an owned album already classified.
SW ns-v58.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc4d3b72d2
commit
fbee695aad
3 files changed
+16
-2
No files matched your search
+11
-1
@@ -293,7 +293,7 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
|
||||
el.innerHTML = '<div class="spinner"></div>';
|
||||
|
||||
// Match each Deezer album to a Navidrome album by normalized name.
|
||||
const entries = iAlbums.map(ia => {
|
||||
const allEntries = iAlbums.map(ia => {
|
||||
const iName = _normAlbum(ia.collectionName);
|
||||
const match = ndAlbums.find(a => {
|
||||
const n = _normAlbum(a.name);
|
||||
@@ -301,6 +301,16 @@ async function _renderArtistAlbums(el, ndAlbums, iAlbums, artist) {
|
||||
});
|
||||
return { ia, match };
|
||||
});
|
||||
// Deezer returns the same album several times (single/EP/album/regional/explicit variants), which
|
||||
// rendered one owned album 3× ("PIXELATED KISSES"). Collapse to one entry per owned Navidrome album
|
||||
// and one per not-owned title.
|
||||
const entries = [];
|
||||
const seenNd = new Set(), seenName = new Set();
|
||||
for (const e of allEntries) {
|
||||
if (e.match) { if (seenNd.has(e.match.id)) continue; seenNd.add(e.match.id); }
|
||||
else { const k = _normAlbum(e.ia.collectionName); if (seenName.has(k)) continue; seenName.add(k); }
|
||||
entries.push(e);
|
||||
}
|
||||
|
||||
// Deezer's /artist/{id}/albums list omits nb_tracks, so the total is unknown here — which made every
|
||||
// owned album look "incomplete" (e.g. "Moonlight 1 / 0"). Resolve the real track count from the
|
||||
|
||||
Reference in new issue
Block a user