From 8685f5796a99d9700146bae9892319db10508d68 Mon Sep 17 00:00:00 2001 From: Ethan Armbrust Date: Thu, 10 Aug 2023 18:10:29 -0400 Subject: [PATCH] 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 --- server/api/jellyfin.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/server/api/jellyfin.ts b/server/api/jellyfin.ts index b126b55f1..de4e6b7cf 100644 --- a/server/api/jellyfin.ts +++ b/server/api/jellyfin.ts @@ -171,28 +171,25 @@ class JellyfinAPI { public async getLibraries(): Promise { try { - const account = await this.axios.get( - `/Users/${this.userId ?? 'Me'}/Views` - ); + const libraries = await this.axios.get('/Library/VirtualFolders'); - const response: JellyfinLibrary[] = account.data.Items.filter( - (Item: any) => { + const response: JellyfinLibrary[] = libraries.data + .filter((Item: any) => { return ( - Item.Type === 'CollectionFolder' && Item.CollectionType !== 'music' && Item.CollectionType !== 'books' && Item.CollectionType !== 'musicvideos' && Item.CollectionType !== 'homevideos' ); - } - ).map((Item: any) => { - return { - key: Item.Id, - title: Item.Name, - type: Item.CollectionType === 'movies' ? 'movie' : 'show', - agent: 'jellyfin', - }; - }); + }) + .map((Item: any) => { + return { + key: Item.ItemId, + title: Item.Name, + type: Item.CollectionType === 'movies' ? 'movie' : 'show', + agent: 'jellyfin', + }; + }); return response; } catch (e) {