fix(normalize): do not duplicate remixer when included in credit

This commit is contained in:
Kendall Garner
2026-03-27 18:46:12 -07:00
parent a838bdebb7
commit d438c802a4
3 changed files with 24 additions and 8 deletions
@@ -128,7 +128,12 @@ const getArtists = (
}); });
if (participants?.['Remixer']) { if (participants?.['Remixer']) {
result.push(...participants['Remixer']); const existingIds = new Set(result.map((artist) => artist.id));
for (const participant of participants['Remixer']) {
if (!existingIds.has(participant.id)) {
result.push(participant);
}
}
} }
return result; return result;
@@ -153,6 +153,7 @@ const getArtists = (
albumArtists = roleList; albumArtists = roleList;
} else if (role === 'remixer' && includeRemixers) { } else if (role === 'remixer' && includeRemixers) {
remixers = roleList; remixers = roleList;
participants['remixer'] = remixers;
} else { } else {
artists = roleList; artists = roleList;
} }
@@ -200,7 +201,7 @@ const getArtists = (
]; ];
} }
if (artists === undefined && (includeRemixers ? remixers === undefined : true)) { if (artists === undefined) {
artists = [ artists = [
{ {
id: item.artistId, id: item.artistId,
@@ -213,11 +214,16 @@ const getArtists = (
]; ];
} }
return { if (remixers?.length && includeRemixers) {
albumArtists, const existingIds = new Set(artists.map((artist) => artist.id));
artists: [...(artists || []), ...(includeRemixers ? remixers || [] : [])], for (const remixer of remixers) {
participants, if (!existingIds.has(remixer.id)) {
}; artists.push(remixer);
}
}
}
return { albumArtists, artists, participants };
}; };
const normalizeSong = ( const normalizeSong = (
@@ -50,7 +50,12 @@ const getArtistList = (
}); });
if (participants?.['remixer']) { if (participants?.['remixer']) {
result.push(...participants['remixer']); const existingIds = new Set(result.map((artist) => artist.id));
for (const participant of participants['remixer']) {
if (!existingIds.has(participant.id)) {
result.push(participant);
}
}
} }
return result; return result;