This commit is contained in:
2026-07-24 18:54:31 +02:00
parent 9132e67371
commit 6412a657e7
23 changed files with 187 additions and 175 deletions
-42
View File
@@ -1,42 +0,0 @@
export interface HomeArtist {
id: string;
name: string;
}
const FILLER_ARTISTS = [
'Nova Reyes',
'The Paper Lanterns',
'Kairo',
'Lucía Marés',
'Midnight Transit',
'Sundown Kids',
'Aria Volkov',
'El Bosque Rojo',
'Halcyon',
'Marea Baja'
];
export function pickTopArtists(tracks: { artist?: string | null }[], limit: number): HomeArtist[] {
const seen = new Set<string>();
const artists: HomeArtist[] = [];
for (const track of tracks) {
for (const name of (track.artist ?? '').split(',').map((part) => part.trim())) {
const key = name.toLowerCase();
if (!name || seen.has(key)) continue;
seen.add(key);
artists.push({ id: name, name });
if (artists.length >= limit) return artists;
}
}
for (const name of FILLER_ARTISTS) {
const key = name.toLowerCase();
if (seen.has(key)) continue;
seen.add(key);
artists.push({ id: name, name });
if (artists.length >= limit) break;
}
return artists;
}