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 { parseSearchParams } from '/@/renderer/utils';
|
||||
|
||||
const getCommaDelimitedString = (value: string[]) => {
|
||||
return value.join(',');
|
||||
};
|
||||
|
||||
const api = ky.create({});
|
||||
|
||||
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 } = {
|
||||
albumIds: albumIdsFilter,
|
||||
fields: 'Genres, DateCreated, MediaSources, ParentId',
|
||||
includeItemTypes: 'Audio',
|
||||
limit: query.limit,
|
||||
|
|
|
@ -527,9 +527,14 @@ export enum JFSongListSort {
|
|||
}
|
||||
|
||||
export type JFSongListParams = {
|
||||
albumArtistIds?: string;
|
||||
albumIds?: string;
|
||||
artistIds?: string;
|
||||
contributingArtistIds?: string;
|
||||
filters?: string;
|
||||
genreIds?: string;
|
||||
genres?: string;
|
||||
ids?: string;
|
||||
includeItemTypes: 'Audio';
|
||||
searchTerm?: string;
|
||||
sortBy?: JFSongListSort;
|
||||
|
|
|
@ -237,6 +237,7 @@ const getSongList = async (args: SongListArgs): Promise<NDSongList> => {
|
|||
_order: sortOrderMap.navidrome[query.sortOrder],
|
||||
_sort: songListSortMap.navidrome[query.sortBy],
|
||||
_start: query.startIndex,
|
||||
album_id: query.albumIds,
|
||||
title: query.searchTerm,
|
||||
...query.ndParams,
|
||||
};
|
||||
|
|
|
@ -229,6 +229,7 @@ export enum NDSongListSort {
|
|||
|
||||
export type NDSongListParams = {
|
||||
_sort?: NDSongListSort;
|
||||
album_id?: string[];
|
||||
genre_id?: string;
|
||||
starred?: boolean;
|
||||
} & NDPagination &
|
||||
|
|
|
@ -417,6 +417,7 @@ export enum SongListSort {
|
|||
}
|
||||
|
||||
export type SongListQuery = {
|
||||
albumIds?: string[];
|
||||
jfParams?: {
|
||||
filters?: string;
|
||||
genreIds?: string;
|
||||
|
|
Reference in a new issue