jellyfin random play filter

This commit is contained in:
Kendall Garner 2024-09-01 12:25:50 -07:00
parent 93377dcc4f
commit 80931d1b19
No known key found for this signature in database
GPG key ID: 18D2767419676C87
4 changed files with 37 additions and 2 deletions

View file

@ -56,6 +56,7 @@ import {
MoveItemArgs,
DownloadArgs,
TranscodingArgs,
Played,
} from '/@/renderer/api/types';
import { jfApiClient } from '/@/renderer/api/jellyfin/jellyfin-api';
import { jfNormalize } from './jellyfin-normalize';
@ -892,6 +893,12 @@ const getRandomSongList = async (args: RandomSongListArgs): Promise<RandomSongLi
Fields: 'Genres, DateCreated, MediaSources, ParentId',
GenreIds: query.genre ? query.genre : undefined,
IncludeItemTypes: 'Audio',
IsPlayed:
query.played === Played.Never
? false
: query.played === Played.Played
? true
: undefined,
Limit: query.limit,
ParentId: query.musicFolderId,
Recursive: true,

View file

@ -561,6 +561,7 @@ const songListParameters = paginationParameters.merge(
GenreIds: z.string().optional(),
Genres: z.string().optional(),
IsFavorite: z.boolean().optional(),
IsPlayed: z.boolean().optional(),
SearchTerm: z.string().optional(),
SortBy: z.nativeEnum(songListSort).optional(),
Tags: z.string().optional(),

View file

@ -1073,12 +1073,19 @@ export type SearchResponse = {
songs: Song[];
};
export enum Played {
All = 'all',
Never = 'never',
Played = 'played',
}
export type RandomSongListQuery = {
genre?: string;
limit?: number;
maxYear?: number;
minYear?: number;
musicFolderId?: string;
played: Played;
};
export type RandomSongListArgs = {