Skip to content

Commit

Permalink
fix(server/api/jellyfin.ts): use /Library/VirtualFolders Jellyfin API…
Browse files Browse the repository at this point in the history
… call to fetch Jellyfin libs

use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libraries, instead of relying on
user's view

fix Fallenbagel#256
  • Loading branch information
EthanArmbrust committed Aug 10, 2023
1 parent acc230f commit 8685f57
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions server/api/jellyfin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,28 +171,25 @@ class JellyfinAPI {

public async getLibraries(): Promise<JellyfinLibrary[]> {
try {
const account = await this.axios.get<any>(
`/Users/${this.userId ?? 'Me'}/Views`
);
const libraries = await this.axios.get<any>('/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 <JellyfinLibrary>{
key: Item.Id,
title: Item.Name,
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
agent: 'jellyfin',
};
});
})
.map((Item: any) => {
return <JellyfinLibrary>{
key: Item.ItemId,
title: Item.Name,
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
agent: 'jellyfin',
};
});

return response;
} catch (e) {
Expand Down

0 comments on commit 8685f57

Please sign in to comment.