From 1c3a02b75e9ce04ff38fa2bc29367d1dac747c00 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Fri, 1 Dec 2023 10:39:47 -0500 Subject: [PATCH] [36] prep for batch edits --- VERSION | 2 +- config/config.yml.template | 2 +- modules/config.py | 6 ++++-- modules/library.py | 5 ++--- modules/operations.py | 1 - modules/plex.py | 13 +++++++++++++ 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index 0a0c8a58..cd61b248 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.19.1-develop35 +1.19.1-develop36 diff --git a/config/config.yml.template b/config/config.yml.template index a522f228..fc0856c6 100644 --- a/config/config.yml.template +++ b/config/config.yml.template @@ -33,7 +33,7 @@ playlist_files: libraries: Movies, TV Shows # list of libraries that you want the PMM Defaults playlists to look at # see the wiki for how to use local files, folders, URLs, or files from git settings: - run_order: metadata, overlays, operations + run_order: operations, metadata, overlays cache: true cache_expiration: 60 asset_directory: config/assets diff --git a/modules/config.py b/modules/config.py index ce328ff0..1fcb4a71 100644 --- a/modules/config.py +++ b/modules/config.py @@ -110,7 +110,7 @@ library_operations = { "mass_critic_rating_update": mass_rating_options, "mass_episode_critic_rating_update": mass_episode_rating_options, "mass_user_rating_update": mass_rating_options, "mass_episode_user_rating_update": mass_episode_rating_options, "mass_original_title_update": mass_original_title_options, "mass_originally_available_update": mass_available_options, - "mass_imdb_parental_labels": imdb_label_options, "mass_episode_imdb_parental_labels": imdb_label_options, + "mass_imdb_parental_labels": imdb_label_options, "mass_collection_mode": "mass_collection_mode", "mass_poster_update": "dict", "mass_background_update": "dict", "metadata_backup": "dict", "delete_collections": "dict", "genre_mapper": "dict", "content_rating_mapper": "dict", } @@ -812,7 +812,9 @@ class ConfigFile: if "mapper" in op: params[op] = input_dict for old_value, new_value in input_dict.items(): - if old_value == new_value: + if not old_value: + logger.warning("Config Warning: The key cannot be empty") + elif old_value == new_value: logger.warning(f"Config Warning: {op} value '{new_value}' ignored as it cannot be mapped to itself") else: params[op][old_value] = new_value if new_value else None diff --git a/modules/library.py b/modules/library.py index ee4d0b95..e39dc460 100644 --- a/modules/library.py +++ b/modules/library.py @@ -94,7 +94,6 @@ class Library(ABC): self.mass_original_title_update = params["mass_original_title_update"] self.mass_originally_available_update = params["mass_originally_available_update"] self.mass_imdb_parental_labels = params["mass_imdb_parental_labels"] - self.mass_episode_imdb_parental_labels = params["mass_episode_imdb_parental_labels"] self.mass_poster_update = params["mass_poster_update"] self.mass_background_update = params["mass_background_update"] self.radarr_add_all_existing = params["radarr_add_all_existing"] @@ -122,13 +121,13 @@ class Library(ABC): or self.mass_audience_rating_update or self.mass_critic_rating_update or self.mass_user_rating_update \ or self.mass_episode_audience_rating_update or self.mass_episode_critic_rating_update or self.mass_episode_user_rating_update \ or self.mass_content_rating_update or self.mass_originally_available_update or self.mass_original_title_update\ - or self.mass_imdb_parental_labels or self.mass_episode_imdb_parental_labels or self.genre_mapper or self.content_rating_mapper or self.mass_studio_update\ + or self.mass_imdb_parental_labels or self.genre_mapper or self.content_rating_mapper or self.mass_studio_update\ or self.radarr_add_all_existing or self.sonarr_add_all_existing or self.mass_poster_update or self.mass_background_update else False self.library_operation = True if self.items_library_operation or self.delete_collections or self.mass_collection_mode \ or self.radarr_remove_by_tag or self.sonarr_remove_by_tag or self.show_unmanaged or self.show_unconfigured \ or self.metadata_backup or self.update_blank_track_titles else False self.meta_operations = [i["source"] if isinstance(i, dict) else i for i in [getattr(self, o) for o in operations.meta_operations] if i] - self.label_operations = True if self.assets_for_all or self.mass_imdb_parental_labels or self.mass_episode_imdb_parental_labels else False + self.label_operations = True if self.assets_for_all or self.mass_imdb_parental_labels else False if self.asset_directory: logger.info("") diff --git a/modules/operations.py b/modules/operations.py index 241fc27e..435d4326 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -38,7 +38,6 @@ class Operations: logger.debug(f"Mass Original Title Update: {self.library.mass_original_title_update}") logger.debug(f"Mass Originally Available Update: {self.library.mass_originally_available_update}") logger.debug(f"Mass IMDb Parental Labels: {self.library.mass_imdb_parental_labels}") - logger.debug(f"Mass Episode IMDb Parental Labels: {self.library.mass_episode_imdb_parental_labels}") logger.debug(f"Mass Poster Update: {self.library.mass_poster_update}") logger.debug(f"Mass Background Update: {self.library.mass_background_update}") logger.debug(f"Mass Collection Mode Update: {self.library.mass_collection_mode}") diff --git a/modules/plex.py b/modules/plex.py index 12ef28a8..9c63c658 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -732,6 +732,19 @@ class Plex(Library): item._autoReload = False return item + def load_from_cache(self, rating_key): + if rating_key in self.cached_items: + item, _ = self.cached_items[rating_key] + return item + + def load_list_from_cache(self, rating_keys): + item_list = [] + for rating_key in rating_keys: + item = self.load_from_cache(rating_key) + if item: + item_list.append(item) + return item_list + @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) def reload(self, item, force=False): is_full = False