Skip to content

Commit

Permalink
Merge pull request #524 from Fallenbagel/fix-library-sync-for-ldap-su…
Browse files Browse the repository at this point in the history
…pport

revert(jellyfinapi): reverts #450 as it broke library sync support for local accounts using LDAP
  • Loading branch information
Fallenbagel authored Nov 6, 2023
2 parents 506ea92 + b5acc09 commit 31bc6ca
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions server/api/jellyfin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,31 @@ class JellyfinAPI {

public async getLibraries(): Promise<JellyfinLibrary[]> {
try {
const libraries = await this.axios.get<any>('/Library/VirtualFolders');
// TODO: Try to fix automatic grouping without fucking up LDAP users
// const libraries = await this.axios.get<any>('/Library/VirtualFolders');

const response: JellyfinLibrary[] = libraries.data
.filter((Item: any) => {
const account = await this.axios.get<any>(
`/Users/${this.userId ?? 'Me'}/Views`
);

const response: JellyfinLibrary[] = account.data.Items.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.ItemId,
title: Item.Name,
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
agent: 'jellyfin',
};
});
}
).map((Item: any) => {
return <JellyfinLibrary>{
key: Item.Id,
title: Item.Name,
type: Item.CollectionType === 'movies' ? 'movie' : 'show',
agent: 'jellyfin',
};
});

return response;
} catch (e) {
Expand Down

0 comments on commit 31bc6ca

Please sign in to comment.