Revert jellyfin getPlaylistList implementation (#272)

This commit is contained in:
jeffvli 2023-10-22 16:00:41 -07:00
parent 86fb52f6d4
commit 02c8cbcad6

View file

@ -102,9 +102,9 @@ const authenticate = async (
Username: body.username, Username: body.username,
}, },
headers: { headers: {
'x-emby-authorization': `MediaBrowser Client="Feishin", Device="${getHostname()}", DeviceId="Feishin-${getHostname()}-${body.username}", Version="${ 'x-emby-authorization': `MediaBrowser Client="Feishin", Device="${getHostname()}", DeviceId="Feishin-${getHostname()}-${
packageJson.version body.username
}"`, }", Version="${packageJson.version}"`,
}, },
}); });
@ -561,20 +561,6 @@ 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,
@ -583,7 +569,8 @@ 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,
ParentId: playlistFolder?.Id, MediaTypes: 'Audio',
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],