|
|
@@ -218,10 +218,22 @@ export class JellyfinApi {
|
|
|
const response = await this.get<JellyfinItemsResponse>(account, `/Users/${auth.userId}/Items`, params);
|
|
|
const items = response.Items ?? [];
|
|
|
const songs: JellyfinSong[] = [];
|
|
|
+ const seenIds = new Set<string>();
|
|
|
+ const seenComposite = new Set<string>();
|
|
|
for (let i = 0; i < items.length; i++) {
|
|
|
+ const itemId = items[i].Id as string | undefined;
|
|
|
+ if (!itemId || seenIds.has(itemId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
const song = this.toSong(items[i]);
|
|
|
if (song) {
|
|
|
+ const compositeKey = `${song.title ?? ''}__${song.artist ?? ''}__${song.album ?? ''}__${song.durationSeconds ?? ''}`;
|
|
|
+ if (seenComposite.has(compositeKey)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
songs.push(song);
|
|
|
+ seenIds.add(song.id);
|
|
|
+ seenComposite.add(compositeKey);
|
|
|
}
|
|
|
}
|
|
|
return songs;
|