diff --git a/src/renderer/api/jellyfin/jellyfin-controller.ts b/src/renderer/api/jellyfin/jellyfin-controller.ts index 032093213..f0893afe4 100644 --- a/src/renderer/api/jellyfin/jellyfin-controller.ts +++ b/src/renderer/api/jellyfin/jellyfin-controller.ts @@ -326,7 +326,7 @@ export const JellyfinController: InternalControllerEndpoint = { SortBy: albumListSortMap.jellyfin[query.sortBy] || 'SortName', SortOrder: sortOrderMap.jellyfin[query.sortOrder], StartIndex: query.startIndex, - ...query._custom?.jellyfin, + ...query._custom, Years: yearsFilter, }, }); @@ -748,7 +748,7 @@ export const JellyfinController: InternalControllerEndpoint = { SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName', SortOrder: sortOrderMap.jellyfin[query.sortOrder], StartIndex: query.startIndex, - ...query._custom?.jellyfin, + ...query._custom, Years: yearsFilter, }, }); @@ -783,7 +783,7 @@ export const JellyfinController: InternalControllerEndpoint = { SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName', SortOrder: sortOrderMap.jellyfin[query.sortOrder], StartIndex: query.startIndex, - ...query._custom?.jellyfin, + ...query._custom, Years: yearsFilter, }, }); diff --git a/src/renderer/api/navidrome/navidrome-controller.ts b/src/renderer/api/navidrome/navidrome-controller.ts index b2803e484..f7063007a 100644 --- a/src/renderer/api/navidrome/navidrome-controller.ts +++ b/src/renderer/api/navidrome/navidrome-controller.ts @@ -111,8 +111,7 @@ export const NavidromeController: InternalControllerEndpoint = { comment: body.comment, name: body.name, public: body.public, - rules: body._custom?.navidrome?.rules, - sync: body._custom?.navidrome?.sync, + ...body._custom, }, }); @@ -191,7 +190,7 @@ export const NavidromeController: InternalControllerEndpoint = { _sort: albumArtistListSortMap.navidrome[query.sortBy], _start: query.startIndex, name: query.searchTerm, - ...query._custom?.navidrome, + ...query._custom, role: hasFeature(apiClientProps.server, ServerFeature.BFR) ? 'albumartist' : '', ...excludeMissing(apiClientProps.server), }, @@ -289,7 +288,7 @@ export const NavidromeController: InternalControllerEndpoint = { compilation: query.compilation, genre_id: genres, name: query.searchTerm, - ...query._custom?.navidrome, + ...query._custom, starred: query.favorite, ...excludeMissing(apiClientProps.server), }, @@ -320,7 +319,7 @@ export const NavidromeController: InternalControllerEndpoint = { _sort: albumArtistListSortMap.navidrome[query.sortBy], _start: query.startIndex, name: query.searchTerm, - ...query._custom?.navidrome, + ...query._custom, role: query.role || undefined, ...excludeMissing(apiClientProps.server), }, @@ -395,7 +394,7 @@ export const NavidromeController: InternalControllerEndpoint = { }, getPlaylistList: async (args) => { const { apiClientProps, query } = args; - const customQuery = query._custom?.navidrome; + const customQuery = query._custom; // Smart playlists only became available in 0.48.0. Do not filter for previous versions if ( @@ -570,7 +569,7 @@ export const NavidromeController: InternalControllerEndpoint = { [getArtistSongKey(apiClientProps.server)]: query.artistIds ?? query.albumArtistIds, starred: query.favorite, title: query.searchTerm, - ...query._custom?.navidrome, + ...query._custom, ...excludeMissing(apiClientProps.server), }, }); @@ -643,7 +642,7 @@ export const NavidromeController: InternalControllerEndpoint = { _order: sortOrderMap.navidrome[query.sortOrder], _sort: userListSortMap.navidrome[query.sortBy], _start: query.startIndex, - ...query._custom?.navidrome, + ...query._custom, }, }); @@ -724,8 +723,7 @@ export const NavidromeController: InternalControllerEndpoint = { comment: body.comment || '', name: body.name, public: body?.public || false, - rules: body._custom?.navidrome?.rules ? body._custom.navidrome.rules : undefined, - sync: body._custom?.navidrome?.sync || undefined, + ...body._custom, }, params: { id: query.id, diff --git a/src/shared/types/domain-types.ts b/src/shared/types/domain-types.ts index 2689e3c40..004548549 100644 --- a/src/shared/types/domain-types.ts +++ b/src/shared/types/domain-types.ts @@ -2,7 +2,6 @@ import { Omit } from 'lodash'; import orderBy from 'lodash/orderBy'; import reverse from 'lodash/reverse'; import shuffle from 'lodash/shuffle'; -import { z } from 'zod'; import { JFAlbumArtistListSort, @@ -12,7 +11,6 @@ import { JFPlaylistListSort, JFSongListSort, JFSortOrder, - jfType, } from '/@/shared/api/jellyfin/jellyfin-types'; import { NDAlbumArtistListSort, @@ -21,7 +19,6 @@ import { NDPlaylistListSort, NDSongListSort, NDSortOrder, - ndType, NDUserListSort, } from '/@/shared/api/navidrome/navidrome-types'; import { ServerFeatures } from '/@/shared/types/features-types'; @@ -428,11 +425,8 @@ export type AlbumListArgs = BaseEndpointArgs & { query: AlbumListQuery }; export type AlbumListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; -export interface AlbumListQuery extends BaseQuery { - _custom?: { - jellyfin?: Partial>; - navidrome?: Partial>; - }; +export interface AlbumListQuery extends AlbumListNavidromeQuery, BaseQuery { + _custom?: Record; artistIds?: string[]; compilation?: boolean; favorite?: boolean; @@ -450,6 +444,11 @@ export type AlbumListResponse = BasePaginatedResponse; export type ListCountQuery = Omit; +interface AlbumListNavidromeQuery { + hasRating?: boolean; + isRecentlyPlayed?: boolean; +} + type AlbumListSortMap = { jellyfin: Record; navidrome: Record; @@ -553,10 +552,7 @@ export type SongListArgs = BaseEndpointArgs & { query: SongListQuery }; export type SongListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; export interface SongListQuery extends BaseQuery { - _custom?: { - jellyfin?: Partial>; - navidrome?: Partial>; - }; + _custom?: Record; albumArtistIds?: string[]; albumIds?: string[]; artistIds?: string[]; @@ -668,10 +664,7 @@ export type AlbumArtistListCountArgs = BaseEndpointArgs & { }; export interface AlbumArtistListQuery extends BaseQuery { - _custom?: { - jellyfin?: Partial>; - navidrome?: Partial>; - }; + _custom?: Record; limit?: number; musicFolderId?: string; searchTerm?: string; @@ -763,10 +756,7 @@ export type ArtistListArgs = BaseEndpointArgs & { query: ArtistListQuery }; export type ArtistListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; export interface ArtistListQuery extends BaseQuery { - _custom?: { - jellyfin?: Partial>; - navidrome?: Partial>; - }; + _custom?: Record; limit?: number; musicFolderId?: string; role?: string; @@ -855,14 +845,7 @@ export type AddToPlaylistResponse = null | undefined; export type CreatePlaylistArgs = BaseEndpointArgs & { body: CreatePlaylistBody }; export type CreatePlaylistBody = { - _custom?: { - navidrome?: { - owner?: string; - ownerId?: string; - rules?: Record; - sync?: boolean; - }; - }; + _custom?: Record; comment?: string; name: string; public?: boolean; @@ -895,10 +878,7 @@ export type PlaylistListArgs = BaseEndpointArgs & { query: PlaylistListQuery }; export type PlaylistListCountArgs = BaseEndpointArgs & { query: ListCountQuery }; export interface PlaylistListQuery extends BaseQuery { - _custom?: { - jellyfin?: Partial>; - navidrome?: Partial>; - }; + _custom?: Record; limit?: number; searchTerm?: string; startIndex: number; @@ -948,14 +928,7 @@ export type UpdatePlaylistArgs = BaseEndpointArgs & { }; export type UpdatePlaylistBody = { - _custom?: { - navidrome?: { - owner?: string; - ownerId?: string; - rules?: Record; - sync?: boolean; - }; - }; + _custom?: Record; comment?: string; genres?: Genre[]; name: string; @@ -1043,11 +1016,7 @@ export type PlaylistSongListResponse = BasePaginatedResponse; export type UserListArgs = BaseEndpointArgs & { query: UserListQuery }; export interface UserListQuery extends BaseQuery { - _custom?: { - navidrome?: { - owner_id?: string; - }; - }; + _custom?: Record; limit?: number; searchTerm?: string; startIndex: number; @@ -1514,7 +1483,7 @@ export const sortAlbumList = (albums: Album[], sortBy: AlbumListSort, sortOrder: return results; }; -export const sortSongList = (songs: QueueSong[], sortBy: SongListSort, sortOrder: SortOrder) => { +export const sortSongList = (songs: Song[], sortBy: SongListSort, sortOrder: SortOrder) => { let results = songs; const order = sortOrder === SortOrder.ASC ? 'asc' : 'desc';