From 345d6c1f4abd2955e29d3c1632edee94e3413251 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sun, 26 Jun 2022 12:31:22 -0400 Subject: [PATCH] [60] small fixes --- VERSION | 2 +- docs/config/libraries.md | 2 +- modules/builder.py | 5 +++-- modules/config.py | 8 +++++--- modules/library.py | 2 +- modules/meta.py | 2 +- modules/overlays.py | 6 ++++-- 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index b15d3367..48978ebb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.0-develop59 +1.17.0-develop60 diff --git a/docs/config/libraries.md b/docs/config/libraries.md index 46d74044..15b3af52 100644 --- a/docs/config/libraries.md +++ b/docs/config/libraries.md @@ -197,7 +197,7 @@ Library template variables to be applied to every Metadata and Overlay file run. ```yaml libraries: Movies: - template_variable: + template_variables: collection_mode: true ``` diff --git a/modules/builder.py b/modules/builder.py index 149da25c..9f133038 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -2311,8 +2311,9 @@ class CollectionBuilder: tmdb_paths = [] tvdb_paths = [] for item in self.items: - if "item_assets" in self.item_details and self.library.asset_directory and "Overlay" not in [la.tag for la in self.library.item_labels(item)]: - self.library.find_and_upload_assets(item) + current_labels = [la.tag for la in self.library.item_labels(item)] + if "item_assets" in self.item_details and self.library.asset_directory and "Overlay" not in current_labels: + self.library.find_and_upload_assets(item, current_labels) self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags) path = os.path.dirname(str(item.locations[0])) if self.library.is_movie else str(item.locations[0]) if self.library.Radarr and item.ratingKey in self.library.movie_rating_key_map: diff --git a/modules/config.py b/modules/config.py index 32258e0c..ea3c176b 100644 --- a/modules/config.py +++ b/modules/config.py @@ -775,7 +775,7 @@ class ConfigFile: params["overlay_path"] = [] params["remove_overlays"] = False - params["reapply_overlay"] = False + params["reapply_overlays"] = False if lib and "overlay_path" in lib: try: if not lib["overlay_path"]: @@ -786,10 +786,12 @@ class ConfigFile: for file in util.get_list(lib["overlay_path"], split=False): if isinstance(file, dict): if ("remove_overlays" in file and file["remove_overlays"] is True) \ + or ("remove_overlay" in file and file["remove_overlay"] is True) \ or ("revert_overlays" in file and file["revert_overlays"] is True): params["remove_overlays"] = True - if "reapply_overlay" in file and file["reapply_overlay"] is True: - params["reapply_overlay"] = True + if ("reapply_overlays" in file and file["reapply_overlays"] is True) \ + or ("reapply_overlay" in file and file["reapply_overlay"] is True): + params["reapply_overlays"] = True if "schedule" in file and file["schedule"]: logger.debug(f"Value: {file['schedule']}") err = None diff --git a/modules/library.py b/modules/library.py index e0a1ea8f..0959fa4b 100644 --- a/modules/library.py +++ b/modules/library.py @@ -93,7 +93,7 @@ class Library(ABC): self.update_blank_track_titles = params["update_blank_track_titles"] self.remove_title_parentheses = params["remove_title_parentheses"] self.remove_overlays = params["remove_overlays"] - self.reapply_overlay = params["reapply_overlay"] + self.reapply_overlays = params["reapply_overlays"] self.mass_collection_mode = params["mass_collection_mode"] self.metadata_backup = params["metadata_backup"] self.genre_mapper = params["genre_mapper"] diff --git a/modules/meta.py b/modules/meta.py index 4f9516a5..e2ce0632 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -386,7 +386,7 @@ class MetadataFile(DataFile): logger.ghost(f"Processing: {i}/{len(all_items)} {item.title}") tmdb_id, tvdb_id, imdb_id = library.get_ids(item) tmdb_item = config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=True) - if tmdb_item and tmdb_item.collection_id: + if tmdb_item and tmdb_item.collection_id and tmdb_item.collection_name: all_keys.append(str(tmdb_item.collection_id)) if str(tmdb_item.collection_id) not in exclude and tmdb_item.collection_name not in exclude: auto_list[str(tmdb_item.collection_id)] = tmdb_item.collection_name diff --git a/modules/overlays.py b/modules/overlays.py index 9c3fe2a2..ead743a9 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -131,12 +131,14 @@ class Overlays: overlay_change = True try: - poster, _, item_dir, name = self.library.find_item_assets(item) + poster, background, item_dir, name = self.library.find_item_assets(item) if not poster and self.library.assets_for_all and self.library.show_missing_assets: if self.library.asset_folders: logger.warning(f"Asset Warning: No poster found in the assets folder '{item_dir}'") else: logger.warning(f"Asset Warning: No poster '{name}' found in the assets folders") + if background: + self.library.upload_images(item, background=background) except Failed as e: if self.library.assets_for_all and self.library.show_missing_assets: logger.warning(e) @@ -174,7 +176,7 @@ class Overlays: poster_compare = None if poster is None and has_original is None: logger.error(f"{item_title[:60]:<60} | Overlay Error: No poster found") - elif self.library.reapply_overlay or changed_image or overlay_change: + elif self.library.reapply_overlays or changed_image or overlay_change: try: canvas_width = 1920 if isinstance(item, Episode) else 1000 canvas_height = 1080 if isinstance(item, Episode) else 1500