Support fetching song list by album id
This commit is contained in:
parent
b39d11c0cc
commit
c86b452c90
5 changed files with 15 additions and 1 deletions
|
@ -63,6 +63,10 @@ import { useAuthStore } from '/@/renderer/store';
|
||||||
import { ServerListItem, ServerType } from '/@/renderer/types';
|
import { ServerListItem, ServerType } from '/@/renderer/types';
|
||||||
import { parseSearchParams } from '/@/renderer/utils';
|
import { parseSearchParams } from '/@/renderer/utils';
|
||||||
|
|
||||||
|
const getCommaDelimitedString = (value: string[]) => {
|
||||||
|
return value.join(',');
|
||||||
|
};
|
||||||
|
|
||||||
const api = ky.create({});
|
const api = ky.create({});
|
||||||
|
|
||||||
const authenticate = async (
|
const authenticate = async (
|
||||||
|
@ -297,9 +301,11 @@ const getSongList = async (args: SongListArgs): Promise<JFSongList> => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const yearsFilter = yearsGroup.length ? yearsGroup.join(',') : undefined;
|
const yearsFilter = yearsGroup.length ? getCommaDelimitedString(yearsGroup) : undefined;
|
||||||
|
const albumIdsFilter = query.albumIds ? getCommaDelimitedString(query.albumIds) : undefined;
|
||||||
|
|
||||||
const searchParams: JFSongListParams & { maxYear?: number; minYear?: number } = {
|
const searchParams: JFSongListParams & { maxYear?: number; minYear?: number } = {
|
||||||
|
albumIds: albumIdsFilter,
|
||||||
fields: 'Genres, DateCreated, MediaSources, ParentId',
|
fields: 'Genres, DateCreated, MediaSources, ParentId',
|
||||||
includeItemTypes: 'Audio',
|
includeItemTypes: 'Audio',
|
||||||
limit: query.limit,
|
limit: query.limit,
|
||||||
|
|
|
@ -527,9 +527,14 @@ export enum JFSongListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type JFSongListParams = {
|
export type JFSongListParams = {
|
||||||
|
albumArtistIds?: string;
|
||||||
|
albumIds?: string;
|
||||||
|
artistIds?: string;
|
||||||
|
contributingArtistIds?: string;
|
||||||
filters?: string;
|
filters?: string;
|
||||||
genreIds?: string;
|
genreIds?: string;
|
||||||
genres?: string;
|
genres?: string;
|
||||||
|
ids?: string;
|
||||||
includeItemTypes: 'Audio';
|
includeItemTypes: 'Audio';
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy?: JFSongListSort;
|
sortBy?: JFSongListSort;
|
||||||
|
|
|
@ -237,6 +237,7 @@ const getSongList = async (args: SongListArgs): Promise<NDSongList> => {
|
||||||
_order: sortOrderMap.navidrome[query.sortOrder],
|
_order: sortOrderMap.navidrome[query.sortOrder],
|
||||||
_sort: songListSortMap.navidrome[query.sortBy],
|
_sort: songListSortMap.navidrome[query.sortBy],
|
||||||
_start: query.startIndex,
|
_start: query.startIndex,
|
||||||
|
album_id: query.albumIds,
|
||||||
title: query.searchTerm,
|
title: query.searchTerm,
|
||||||
...query.ndParams,
|
...query.ndParams,
|
||||||
};
|
};
|
||||||
|
|
|
@ -229,6 +229,7 @@ export enum NDSongListSort {
|
||||||
|
|
||||||
export type NDSongListParams = {
|
export type NDSongListParams = {
|
||||||
_sort?: NDSongListSort;
|
_sort?: NDSongListSort;
|
||||||
|
album_id?: string[];
|
||||||
genre_id?: string;
|
genre_id?: string;
|
||||||
starred?: boolean;
|
starred?: boolean;
|
||||||
} & NDPagination &
|
} & NDPagination &
|
||||||
|
|
|
@ -417,6 +417,7 @@ export enum SongListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SongListQuery = {
|
export type SongListQuery = {
|
||||||
|
albumIds?: string[];
|
||||||
jfParams?: {
|
jfParams?: {
|
||||||
filters?: string;
|
filters?: string;
|
||||||
genreIds?: string;
|
genreIds?: string;
|
||||||
|
|
Reference in a new issue