mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
remove _custom query usage for playlists
This commit is contained in:
@@ -143,8 +143,10 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
body: {
|
||||
comment: body.comment,
|
||||
name: body.name,
|
||||
ownerId: body.ownerId,
|
||||
public: body.public,
|
||||
...body._custom,
|
||||
rules: body.queryBuilderRules,
|
||||
sync: body.sync,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -326,9 +328,9 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
library_id: getLibraryId(query.musicFolderId),
|
||||
name: query.searchTerm,
|
||||
recently_played: query.isRecentlyPlayed,
|
||||
starred: query.favorite,
|
||||
year: query.maxYear || query.minYear,
|
||||
...query._custom,
|
||||
starred: query.favorite,
|
||||
...excludeMissing(apiClientProps.server),
|
||||
},
|
||||
});
|
||||
@@ -359,9 +361,9 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
_start: query.startIndex,
|
||||
library_id: getLibraryId(query.musicFolderId),
|
||||
name: query.searchTerm,
|
||||
role: query.role || undefined,
|
||||
starred: query.favorite,
|
||||
...query._custom,
|
||||
role: query.role || undefined,
|
||||
...excludeMissing(apiClientProps.server),
|
||||
},
|
||||
});
|
||||
@@ -471,16 +473,6 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
},
|
||||
getPlaylistList: async (args) => {
|
||||
const { apiClientProps, query } = args;
|
||||
const customQuery = query._custom;
|
||||
|
||||
// Smart playlists only became available in 0.48.0. Do not filter for previous versions
|
||||
if (
|
||||
customQuery &&
|
||||
customQuery.smart !== undefined &&
|
||||
!hasFeature(apiClientProps.server, ServerFeature.PLAYLISTS_SMART)
|
||||
) {
|
||||
customQuery.smart = undefined;
|
||||
}
|
||||
|
||||
const res = await ndApiClient(apiClientProps).getPlaylistList({
|
||||
query: {
|
||||
@@ -489,7 +481,7 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
_sort: query.sortBy ? playlistListSortMap.navidrome[query.sortBy] : undefined,
|
||||
_start: query.startIndex,
|
||||
q: query.searchTerm,
|
||||
...customQuery,
|
||||
smart: query.excludeSmartPlaylists ? false : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -821,7 +813,10 @@ export const NavidromeController: InternalControllerEndpoint = {
|
||||
body: {
|
||||
comment: body.comment || '',
|
||||
name: body.name,
|
||||
ownerId: body.ownerId,
|
||||
public: body?.public || false,
|
||||
rules: body.queryBuilderRules,
|
||||
sync: body.sync,
|
||||
...body._custom,
|
||||
},
|
||||
params: {
|
||||
|
||||
@@ -327,11 +327,6 @@ export const AlbumDetailContent = () => {
|
||||
excludeIds: detailQuery?.data?.id ? [detailQuery.data.id] : undefined,
|
||||
isHidden: !detailQuery?.data?.albumArtists?.[0]?.id,
|
||||
query: {
|
||||
_custom: {
|
||||
jellyfin: {
|
||||
ExcludeItemIds: detailQuery?.data?.id,
|
||||
},
|
||||
},
|
||||
artistIds: detailQuery?.data?.albumArtists.length
|
||||
? [detailQuery?.data?.albumArtists[0].id]
|
||||
: undefined,
|
||||
@@ -346,11 +341,11 @@ export const AlbumDetailContent = () => {
|
||||
excludeIds: detailQuery?.data?.id ? [detailQuery.data.id] : undefined,
|
||||
isHidden: !detailQuery?.data?.genres?.[0],
|
||||
query: {
|
||||
genres: detailQuery?.data?.genres.length
|
||||
genreIds: detailQuery?.data?.genres.length
|
||||
? [detailQuery?.data?.genres[0].id]
|
||||
: undefined,
|
||||
},
|
||||
rowCount: 2,
|
||||
rowCount: 1,
|
||||
sortBy: AlbumListSort.RANDOM,
|
||||
sortOrder: SortOrder.ASC,
|
||||
title: `${t('page.albumDetail.moreFromGeneric', {
|
||||
|
||||
@@ -38,11 +38,7 @@ export const AddToPlaylistAction = ({ items, itemType }: AddToPlaylistActionProp
|
||||
const playlistsQuery = useQuery(
|
||||
playlistsQueries.list({
|
||||
query: {
|
||||
_custom: {
|
||||
navidrome: {
|
||||
smart: false,
|
||||
},
|
||||
},
|
||||
excludeSmartPlaylists: true,
|
||||
sortBy: PlaylistListSort.NAME,
|
||||
sortOrder: SortOrder.ASC,
|
||||
startIndex: 0,
|
||||
|
||||
@@ -74,11 +74,7 @@ export const AddToPlaylistContextModal = ({
|
||||
const playlistList = useQuery(
|
||||
playlistsQueries.list({
|
||||
query: {
|
||||
_custom: {
|
||||
navidrome: {
|
||||
smart: false,
|
||||
},
|
||||
},
|
||||
excludeSmartPlaylists: true,
|
||||
sortBy: PlaylistListSort.NAME,
|
||||
sortOrder: SortOrder.ASC,
|
||||
startIndex: 0,
|
||||
|
||||
@@ -33,13 +33,9 @@ export const CreatePlaylistForm = ({ onCancel }: CreatePlaylistFormProps) => {
|
||||
|
||||
const form = useForm<CreatePlaylistBody>({
|
||||
initialValues: {
|
||||
_custom: {
|
||||
navidrome: {
|
||||
rules: undefined,
|
||||
},
|
||||
},
|
||||
comment: '',
|
||||
name: '',
|
||||
queryBuilderRules: undefined,
|
||||
},
|
||||
});
|
||||
const [isSmartPlaylist, setIsSmartPlaylist] = useState(false);
|
||||
@@ -79,14 +75,7 @@ export const CreatePlaylistForm = ({ onCancel }: CreatePlaylistFormProps) => {
|
||||
apiClientProps: { serverId: server.id },
|
||||
body: {
|
||||
...values,
|
||||
_custom: {
|
||||
navidrome: {
|
||||
...values._custom?.navidrome,
|
||||
rules,
|
||||
},
|
||||
// Top-level rules field is what Navidrome expects for smart playlists.
|
||||
...(rules ? { rules } : {}),
|
||||
},
|
||||
...(rules ? { queryBuilderRules: rules } : {}),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -36,15 +36,10 @@ export const SaveAsPlaylistForm = ({
|
||||
|
||||
const form = useForm<CreatePlaylistBody>({
|
||||
initialValues: {
|
||||
_custom: {
|
||||
navidrome: {
|
||||
rules: undefined,
|
||||
...body?._custom?.navidrome,
|
||||
},
|
||||
},
|
||||
comment: body.comment || '',
|
||||
name: body.name || '',
|
||||
public: body.public,
|
||||
queryBuilderRules: body.queryBuilderRules,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -48,17 +48,12 @@ export const UpdatePlaylistForm = ({ body, onCancel, query, users }: UpdatePlayl
|
||||
|
||||
const form = useForm<UpdatePlaylistBody>({
|
||||
initialValues: {
|
||||
_custom: {
|
||||
navidrome: {
|
||||
owner: body?._custom?.navidrome?.owner || '',
|
||||
ownerId: body?._custom?.navidrome?.ownerId || '',
|
||||
rules: undefined,
|
||||
sync: body?._custom?.navidrome?.sync || false,
|
||||
},
|
||||
},
|
||||
comment: body?.comment || '',
|
||||
name: body?.name || '',
|
||||
ownerId: body.ownerId,
|
||||
public: body.public,
|
||||
queryBuilderRules: body.queryBuilderRules,
|
||||
sync: body.sync,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -114,7 +109,7 @@ export const UpdatePlaylistForm = ({ body, onCancel, query, users }: UpdatePlayl
|
||||
{isOwnerDisplayed && (
|
||||
<Select
|
||||
data={userList || []}
|
||||
{...form.getInputProps('_custom.navidrome.ownerId')}
|
||||
{...form.getInputProps('ownerId')}
|
||||
label={t('form.createPlaylist.input', {
|
||||
context: 'owner',
|
||||
postProcess: 'titleCase',
|
||||
@@ -191,18 +186,13 @@ export const openUpdatePlaylistModal = async (args: {
|
||||
children: (
|
||||
<UpdatePlaylistForm
|
||||
body={{
|
||||
_custom: {
|
||||
navidrome: {
|
||||
owner: playlist?.owner || undefined,
|
||||
ownerId: playlist?.ownerId || undefined,
|
||||
rules: playlist?.rules || undefined,
|
||||
sync: playlist?.sync || undefined,
|
||||
},
|
||||
},
|
||||
comment: playlist?.description || undefined,
|
||||
genres: playlist?.genres,
|
||||
name: playlist?.name,
|
||||
ownerId: playlist?.ownerId || undefined,
|
||||
public: playlist?.public || false,
|
||||
queryBuilderRules: playlist?.rules || undefined,
|
||||
sync: playlist?.sync || undefined,
|
||||
}}
|
||||
onCancel={closeAllModals}
|
||||
query={{ id: playlist?.id }}
|
||||
|
||||
@@ -280,15 +280,12 @@ const PlaylistDetailSongListRoute = () => {
|
||||
{
|
||||
apiClientProps: { serverId: detailQuery?.data?._serverId },
|
||||
body: {
|
||||
_custom: {
|
||||
owner: detailQuery?.data?.owner || '',
|
||||
ownerId: detailQuery?.data?.ownerId || '',
|
||||
rules,
|
||||
sync: detailQuery?.data?.sync || false,
|
||||
},
|
||||
comment: detailQuery?.data?.description || '',
|
||||
name: detailQuery?.data?.name,
|
||||
ownerId: detailQuery?.data?.ownerId || '',
|
||||
public: detailQuery?.data?.public || false,
|
||||
queryBuilderRules: rules,
|
||||
sync: detailQuery?.data?.sync || false,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -332,19 +329,12 @@ const PlaylistDetailSongListRoute = () => {
|
||||
children: (
|
||||
<SaveAsPlaylistForm
|
||||
body={{
|
||||
_custom: {
|
||||
navidrome: {
|
||||
owner: detailQuery?.data?.owner || '',
|
||||
ownerId: detailQuery?.data?.ownerId || '',
|
||||
rules,
|
||||
sync: detailQuery?.data?.sync || false,
|
||||
},
|
||||
rules,
|
||||
sync: detailQuery?.data?.sync || false,
|
||||
},
|
||||
comment: detailQuery?.data?.description || '',
|
||||
name: detailQuery?.data?.name,
|
||||
ownerId: detailQuery?.data?.ownerId || '',
|
||||
public: detailQuery?.data?.public || false,
|
||||
queryBuilderRules: rules,
|
||||
sync: detailQuery?.data?.sync || false,
|
||||
}}
|
||||
onCancel={closeAllModals}
|
||||
onSuccess={(data) =>
|
||||
|
||||
@@ -527,6 +527,7 @@ const createPlaylist = playlist.pick({
|
||||
const createPlaylistParameters = z.object({
|
||||
comment: z.string().optional(),
|
||||
name: z.string(),
|
||||
ownerId: z.string().optional(),
|
||||
public: z.boolean().optional(),
|
||||
rules: z.record(z.any()).optional(),
|
||||
sync: z.boolean().optional(),
|
||||
|
||||
@@ -893,7 +893,10 @@ export type CreatePlaylistBody = {
|
||||
_custom?: Record<string, any>;
|
||||
comment?: string;
|
||||
name: string;
|
||||
ownerId?: string;
|
||||
public?: boolean;
|
||||
queryBuilderRules?: Record<string, any>;
|
||||
sync?: boolean;
|
||||
};
|
||||
|
||||
// Create Playlist
|
||||
@@ -924,6 +927,7 @@ export type PlaylistListCountArgs = BaseEndpointArgs & { query: ListCountQuery<P
|
||||
|
||||
export interface PlaylistListQuery extends BaseQuery<PlaylistListSort> {
|
||||
_custom?: Record<string, any>;
|
||||
excludeSmartPlaylists?: boolean;
|
||||
limit?: number;
|
||||
searchTerm?: string;
|
||||
startIndex: number;
|
||||
@@ -978,7 +982,10 @@ export type UpdatePlaylistBody = {
|
||||
comment?: string;
|
||||
genres?: Genre[];
|
||||
name: string;
|
||||
ownerId?: string;
|
||||
public?: boolean;
|
||||
queryBuilderRules?: Record<string, any>;
|
||||
sync?: boolean;
|
||||
};
|
||||
|
||||
export type UpdatePlaylistQuery = {
|
||||
|
||||
Reference in New Issue
Block a user