From 8b82d7e5524ba85e1cac3d408208d4e8202ac8e3 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 3 Feb 2022 18:24:35 -0500 Subject: [PATCH] load less --- VERSION | 2 +- modules/meta.py | 11 +++++++++++ modules/plex.py | 6 +++++- plex_meta_manager.py | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 6b51c047..8029237d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.15.1-develop45 +1.15.1-develop46 diff --git a/modules/meta.py b/modules/meta.py index 404401fb..6f21cb91 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -355,8 +355,12 @@ class MetadataFile(DataFile): remove_prefix = util.parse("Config", "remove_prefix", dynamic, parent=map_name, methods=methods, datatype="commalist") if "remove_prefix" in methods else [] remove_suffix = util.parse("Config", "remove_suffix", dynamic, parent=map_name, methods=methods, datatype="commalist") if "remove_suffix" in methods else [] sync = {i.title: i for i in self.library.search(libtype="collection", label=str(map_name))} if sync else {} + other_name = util.parse("Config", "other", dynamic, parent=map_name, methods=methods) if "other" in methods else None + other_keys = [] for key, value in auto_list.items(): if include and key not in include: + if key not in exclude: + other_keys.append(key) continue template_call = {"name": template_name, auto_type: [key] + addons[key] if key in addons else key} for k, v in dictionary_variables.items(): @@ -381,6 +385,13 @@ class MetadataFile(DataFile): if collection_title in sync: sync.pop(collection_title) self.collections[collection_title] = col + if other_name: + col = {"template": {"name": template_name, auto_type: other_keys}, "label": str(map_name)} + if test: + col["test"] = True + if other_name in sync: + sync.pop(other_name) + self.collections[other_name] = col for col_title, col in sync.items(): col.delete() logger.info(f"{map_name} Dynamic Collection: {col_title} Deleted") diff --git a/modules/plex.py b/modules/plex.py index ca6ffded..ef319fc6 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -448,7 +448,11 @@ class Plex(Library): def fetchItem(self, data): return self.PlexServer.fetchItem(data) - def get_all(self, collection_level=None): + def get_all(self, collection_level=None, load=False): + if load and not collection_level: + self._all_items = [] + if self._all_items and not collection_level: + return self._all_items collection_type = collection_level if collection_level else self.Plex.TYPE if not collection_level: collection_level = self.type diff --git a/plex_meta_manager.py b/plex_meta_manager.py index ce1c988e..b7c49d62 100644 --- a/plex_meta_manager.py +++ b/plex_meta_manager.py @@ -458,7 +458,7 @@ def library_operations(config, library): tmdb_collections = {} if library.items_library_operation: - items = library.get_all() + items = library.get_all(load=True) radarr_adds = [] sonarr_adds = [] trakt_ratings = config.Trakt.user_ratings(library.is_movie) if library.mass_trakt_rating_update else [] @@ -700,7 +700,7 @@ def library_operations(config, library): logger.info(f"Metadata Backup Path: {library.metadata_backup['path']}") logger.info("") meta = {} - items = library.get_all() + items = library.get_all(load=True) titles = [i.title for i in items] for i, item in enumerate(items, 1): util.print_return(f"Processing: {i}/{len(items)} {item.title}")