Adjust jellyfin playlist fetch
This commit is contained in:
parent
877b2e9f3b
commit
a8bd53b757
1 changed files with 15 additions and 2 deletions
|
@ -529,6 +529,20 @@ const getPlaylistList = async (args: PlaylistListArgs): Promise<PlaylistListResp
|
||||||
throw new Error('No userId found');
|
throw new Error('No userId found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const musicFoldersRes = await jfApiClient(apiClientProps).getMusicFolderList({
|
||||||
|
params: {
|
||||||
|
userId: apiClientProps.server?.userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (musicFoldersRes.status !== 200) {
|
||||||
|
throw new Error('Failed playlist folder');
|
||||||
|
}
|
||||||
|
|
||||||
|
const playlistFolder = musicFoldersRes.body.Items.filter(
|
||||||
|
(folder) => folder.CollectionType === jfType._enum.collection.PLAYLISTS,
|
||||||
|
)?.[0];
|
||||||
|
|
||||||
const res = await jfApiClient(apiClientProps).getPlaylistList({
|
const res = await jfApiClient(apiClientProps).getPlaylistList({
|
||||||
params: {
|
params: {
|
||||||
userId: apiClientProps.server?.userId,
|
userId: apiClientProps.server?.userId,
|
||||||
|
@ -537,8 +551,7 @@ const getPlaylistList = async (args: PlaylistListArgs): Promise<PlaylistListResp
|
||||||
Fields: 'ChildCount, Genres, DateCreated, ParentId, Overview',
|
Fields: 'ChildCount, Genres, DateCreated, ParentId, Overview',
|
||||||
IncludeItemTypes: 'Playlist',
|
IncludeItemTypes: 'Playlist',
|
||||||
Limit: query.limit,
|
Limit: query.limit,
|
||||||
MediaTypes: 'Audio',
|
ParentId: playlistFolder?.Id,
|
||||||
Recursive: true,
|
|
||||||
SearchTerm: query.searchTerm,
|
SearchTerm: query.searchTerm,
|
||||||
SortBy: playlistListSortMap.jellyfin[query.sortBy],
|
SortBy: playlistListSortMap.jellyfin[query.sortBy],
|
||||||
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
||||||
|
|
Reference in a new issue