From fb61eda8315760530d92e9fee34429f4d9552529 Mon Sep 17 00:00:00 2001 From: InfinityPacer <160988576+InfinityPacer@users.noreply.github.com> Date: Wed, 2 Oct 2024 10:39:04 +0800 Subject: [PATCH] fix(mediaserver): improve data isolation handling --- app/modules/emby/emby.py | 2 ++ app/modules/jellyfin/jellyfin.py | 2 ++ app/modules/plex/plex.py | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/modules/emby/emby.py b/app/modules/emby/emby.py index 6e5127ff..81cff170 100644 --- a/app/modules/emby/emby.py +++ b/app/modules/emby/emby.py @@ -91,6 +91,7 @@ class Emby: library_items = res.json().get("Items") librarys = [] for library_item in library_items: + library_id = library_item.get('ItemId') library_name = library_item.get('Name') pathInfos = library_item.get('LibraryOptions', {}).get('PathInfos') library_paths = [] @@ -102,6 +103,7 @@ class Emby: if library_name and library_paths: librarys.append({ + 'Id': library_id, 'Name': library_name, 'Path': library_paths }) diff --git a/app/modules/jellyfin/jellyfin.py b/app/modules/jellyfin/jellyfin.py index 0916142d..0c32c6b0 100644 --- a/app/modules/jellyfin/jellyfin.py +++ b/app/modules/jellyfin/jellyfin.py @@ -88,6 +88,7 @@ class Jellyfin: library_items = res.json() librarys = [] for library_item in library_items: + library_id = library_item.get('ItemId') library_name = library_item.get('Name') pathInfos = library_item.get('LibraryOptions', {}).get('PathInfos') library_paths = [] @@ -99,6 +100,7 @@ class Jellyfin: if library_name and library_paths: librarys.append({ + 'Id': library_id, 'Name': library_name, 'Path': library_paths }) diff --git a/app/modules/plex/plex.py b/app/modules/plex/plex.py index ffcde53d..d031c9d5 100644 --- a/app/modules/plex/plex.py +++ b/app/modules/plex/plex.py @@ -112,7 +112,7 @@ class Plex: return [] libraries = [] for library in self._libraries: - if hidden and self._sync_libraries and library.key not in self._sync_libraries: + if hidden and self._sync_libraries and str(library.key) not in self._sync_libraries: continue match library.type: case "movie": @@ -146,7 +146,7 @@ class Plex: sections = self._plex.library.sections() MovieCount = SeriesCount = EpisodeCount = 0 # 媒体库白名单 - allow_library = [lib.id for lib in self.get_librarys()] + allow_library = [lib.id for lib in self.get_librarys(hidden=True)] for sec in sections: if str(sec.key) not in allow_library: continue @@ -693,7 +693,7 @@ class Plex: if not self._plex: return [] # 媒体库白名单 - allow_library = ",".join([lib.id for lib in self.get_librarys()]) + allow_library = ",".join([lib.id for lib in self.get_librarys(hidden=True)]) params = {"contentDirectoryID": allow_library} items = self._plex.fetchItems("/hubs/continueWatching/items", container_start=0, @@ -729,7 +729,7 @@ class Plex: if not self._plex: return None # 请求参数(除黑名单) - allow_library = ",".join([lib.id for lib in self.get_librarys()]) + allow_library = ",".join([lib.id for lib in self.get_librarys(hidden=True)]) params = { "contentDirectoryID": allow_library, "count": num,