mirror of
https://github.com/jeffvli/feishin.git
synced 2026-08-08 21:32:59 +02:00
239ef4a4ec
- add selection modes: similar, random - add autodj settings in playerbar popover
29 lines
789 B
TypeScript
29 lines
789 B
TypeScript
import type { Genre } from '/@/shared/types/domain-types';
|
|
|
|
import { ServerType } from '/@/shared/types/domain-types';
|
|
|
|
export const autoDjPushUniqueAlbumIds = (
|
|
accumulator: string[],
|
|
seenAlbums: Set<string>,
|
|
queueAlbumIdSet: Set<string>,
|
|
...ids: (string | undefined)[]
|
|
) => {
|
|
for (const id of ids) {
|
|
if (!id || queueAlbumIdSet.has(id) || seenAlbums.has(id)) continue;
|
|
seenAlbums.add(id);
|
|
accumulator.push(id);
|
|
}
|
|
};
|
|
|
|
export const autoDjGenreIdsForSongGenre = (genre: Genre, serverType: ServerType): string[] => {
|
|
if (serverType === ServerType.JELLYFIN) {
|
|
return [genre.id];
|
|
}
|
|
|
|
if (serverType === ServerType.NAVIDROME || serverType === ServerType.SUBSONIC) {
|
|
return [genre.name];
|
|
}
|
|
|
|
return [genre.id];
|
|
};
|