mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-06 20:10:12 +02:00
fix(normalize): do not duplicate remixer when included in credit
This commit is contained in:
@@ -128,7 +128,12 @@ const getArtists = (
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
@@ -153,6 +153,7 @@ const getArtists = (
|
||||
albumArtists = roleList;
|
||||
} else if (role === 'remixer' && includeRemixers) {
|
||||
remixers = roleList;
|
||||
participants['remixer'] = remixers;
|
||||
} else {
|
||||
artists = roleList;
|
||||
}
|
||||
@@ -200,7 +201,7 @@ const getArtists = (
|
||||
];
|
||||
}
|
||||
|
||||
if (artists === undefined && (includeRemixers ? remixers === undefined : true)) {
|
||||
if (artists === undefined) {
|
||||
artists = [
|
||||
{
|
||||
id: item.artistId,
|
||||
@@ -213,11 +214,16 @@ const getArtists = (
|
||||
];
|
||||
}
|
||||
|
||||
return {
|
||||
albumArtists,
|
||||
artists: [...(artists || []), ...(includeRemixers ? remixers || [] : [])],
|
||||
participants,
|
||||
};
|
||||
if (remixers?.length && includeRemixers) {
|
||||
const existingIds = new Set(artists.map((artist) => artist.id));
|
||||
for (const remixer of remixers) {
|
||||
if (!existingIds.has(remixer.id)) {
|
||||
artists.push(remixer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { albumArtists, artists, participants };
|
||||
};
|
||||
|
||||
const normalizeSong = (
|
||||
|
||||
@@ -50,7 +50,12 @@ const getArtistList = (
|
||||
});
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user