mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-31 19:59:31 -05:00
fix(server/api/jellyfin.ts): use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libs
use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libraries, instead of relying on user's view fix #256
This commit is contained in:
@@ -171,28 +171,25 @@ class JellyfinAPI {
|
|||||||
|
|
||||||
public async getLibraries(): Promise<JellyfinLibrary[]> {
|
public async getLibraries(): Promise<JellyfinLibrary[]> {
|
||||||
try {
|
try {
|
||||||
const account = await this.axios.get<any>(
|
const libraries = await this.axios.get<any>('/Library/VirtualFolders');
|
||||||
`/Users/${this.userId ?? 'Me'}/Views`
|
|
||||||
);
|
|
||||||
|
|
||||||
const response: JellyfinLibrary[] = account.data.Items.filter(
|
const response: JellyfinLibrary[] = libraries.data
|
||||||
(Item: any) => {
|
.filter((Item: any) => {
|
||||||
return (
|
return (
|
||||||
Item.Type === 'CollectionFolder' &&
|
|
||||||
Item.CollectionType !== 'music' &&
|
Item.CollectionType !== 'music' &&
|
||||||
Item.CollectionType !== 'books' &&
|
Item.CollectionType !== 'books' &&
|
||||||
Item.CollectionType !== 'musicvideos' &&
|
Item.CollectionType !== 'musicvideos' &&
|
||||||
Item.CollectionType !== 'homevideos'
|
Item.CollectionType !== 'homevideos'
|
||||||
);
|
);
|
||||||
}
|
})
|
||||||
).map((Item: any) => {
|
.map((Item: any) => {
|
||||||
return <JellyfinLibrary>{
|
return <JellyfinLibrary>{
|
||||||
key: Item.Id,
|
key: Item.ItemId,
|
||||||
title: Item.Name,
|
title: Item.Name,
|
||||||
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
|
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
|
||||||
agent: 'jellyfin',
|
agent: 'jellyfin',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user