revert(jellyfinapi): reverts #450 as it broke library sync support for local accounts using LDAP

Reverted #450 which addressed the issue where the automatic grouping enabled libraries were not
functioning correctly. The previous fix inadvertently caused a bug for Jellyfin LDAP users,
preventing library syncing with a 401 error. Reverting this change temporarily until support for
automatic library grouping can be re-implemented

fix #489
This commit is contained in:
fallenbagel
2023-11-07 01:47:54 +05:00
parent 506ea92826
commit b5acc09ba9

View File

@@ -171,25 +171,31 @@ class JellyfinAPI {
public async getLibraries(): Promise<JellyfinLibrary[]> { public async getLibraries(): Promise<JellyfinLibrary[]> {
try { 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 const account = await this.axios.get<any>(
.filter((Item: any) => { `/Users/${this.userId ?? 'Me'}/Views`
);
const response: JellyfinLibrary[] = account.data.Items.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.ItemId, key: Item.Id,
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) {