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');
|
||||
}
|
||||
|
||||
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({
|
||||
params: {
|
||||
userId: apiClientProps.server?.userId,
|
||||
|
@ -537,8 +551,7 @@ const getPlaylistList = async (args: PlaylistListArgs): Promise<PlaylistListResp
|
|||
Fields: 'ChildCount, Genres, DateCreated, ParentId, Overview',
|
||||
IncludeItemTypes: 'Playlist',
|
||||
Limit: query.limit,
|
||||
MediaTypes: 'Audio',
|
||||
Recursive: true,
|
||||
ParentId: playlistFolder?.Id,
|
||||
SearchTerm: query.searchTerm,
|
||||
SortBy: playlistListSortMap.jellyfin[query.sortBy],
|
||||
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
|
||||
|
|
Reference in a new issue