mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
remove compilation from primary album section groupings
This commit is contained in:
@@ -981,71 +981,30 @@ const groupAlbumsByReleaseType = (
|
||||
return acc;
|
||||
}
|
||||
|
||||
// Priority 2: Compilations
|
||||
if (album.isCompilation) {
|
||||
const compilationKey = 'compilation';
|
||||
if (!acc[compilationKey]) {
|
||||
acc[compilationKey] = [];
|
||||
}
|
||||
acc[compilationKey].push(album);
|
||||
return acc;
|
||||
const releaseTypes = album.releaseTypes || [];
|
||||
const normalizedTypes = releaseTypes.map((type) => type.toLowerCase());
|
||||
|
||||
let matchedType: null | string = null;
|
||||
|
||||
if (normalizedTypes.includes('album')) {
|
||||
matchedType = 'album';
|
||||
} else if (normalizedTypes.includes('single')) {
|
||||
matchedType = 'single';
|
||||
} else if (normalizedTypes.includes('ep')) {
|
||||
matchedType = 'ep';
|
||||
} else if (normalizedTypes.includes('broadcast')) {
|
||||
matchedType = 'broadcast';
|
||||
} else if (normalizedTypes.includes('other')) {
|
||||
matchedType = 'other';
|
||||
} else {
|
||||
matchedType = 'album';
|
||||
}
|
||||
|
||||
// Priority 3: EP
|
||||
const hasEPType = album.releaseTypes?.some((type) => type.toLowerCase() === 'ep');
|
||||
if (hasEPType) {
|
||||
const epKey = 'ep';
|
||||
if (!acc[epKey]) {
|
||||
acc[epKey] = [];
|
||||
}
|
||||
acc[epKey].push(album);
|
||||
return acc;
|
||||
const releaseTypeKey = matchedType;
|
||||
if (!acc[releaseTypeKey]) {
|
||||
acc[releaseTypeKey] = [];
|
||||
}
|
||||
|
||||
// Priority 4: Single (other non-album types)
|
||||
const hasSingleType = album.releaseTypes?.some(
|
||||
(type) => type.toLowerCase() === 'single',
|
||||
);
|
||||
if (hasSingleType) {
|
||||
const singleKey = 'single';
|
||||
if (!acc[singleKey]) {
|
||||
acc[singleKey] = [];
|
||||
}
|
||||
acc[singleKey].push(album);
|
||||
return acc;
|
||||
}
|
||||
|
||||
// Priority 5: Broadcast (if has album type)
|
||||
const hasBroadcastType = album.releaseTypes?.some(
|
||||
(type) => type.toLowerCase() === 'broadcast',
|
||||
);
|
||||
|
||||
if (hasBroadcastType) {
|
||||
const broadcastKey = 'broadcast';
|
||||
if (!acc[broadcastKey]) {
|
||||
acc[broadcastKey] = [];
|
||||
}
|
||||
acc[broadcastKey].push(album);
|
||||
return acc;
|
||||
}
|
||||
|
||||
// Priority 6: Other
|
||||
const hasOtherType = album.releaseTypes?.some((type) => type.toLowerCase() === 'other');
|
||||
if (hasOtherType) {
|
||||
const otherKey = 'other';
|
||||
if (!acc[otherKey]) {
|
||||
acc[otherKey] = [];
|
||||
}
|
||||
acc[otherKey].push(album);
|
||||
return acc;
|
||||
}
|
||||
|
||||
// Priority 7: Album (falls back all unknown release types to album)
|
||||
const albumKey = 'album';
|
||||
if (!acc[albumKey]) {
|
||||
acc[albumKey] = [];
|
||||
}
|
||||
acc[albumKey].push(album);
|
||||
acc[releaseTypeKey].push(album);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, Album[]>,
|
||||
|
||||
Reference in New Issue
Block a user