Skip to content

Commit

Permalink
Merge pull request #450 from EthanArmbrust/libview
Browse files Browse the repository at this point in the history
fix(server/api/jellyfin.ts): use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libs
  • Loading branch information
Fallenbagel committed Aug 11, 2023
2 parents acc230f + 8685f57 commit b7282ce
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 b7282ce

Please sign in to comment.