From 9cf79d2a915c869ae09aca4cbaf8b3eea03bf3f5 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 20 Apr 2022 08:56:07 -0400 Subject: [PATCH] [11] suppress Yozora's rage --- VERSION | 2 +- docs/metadata/overlay.md | 8 ++++---- modules/builder.py | 18 +++++++++--------- modules/meta.py | 34 ++++++++++++++++++++++++++++------ modules/overlays.py | 8 ++++---- 5 files changed, 46 insertions(+), 24 deletions(-) diff --git a/VERSION b/VERSION index 6e832de6..4282b3ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop10 +1.16.5-develop11 diff --git a/docs/metadata/overlay.md b/docs/metadata/overlay.md index 1915d129..e668a446 100644 --- a/docs/metadata/overlay.md +++ b/docs/metadata/overlay.md @@ -87,11 +87,11 @@ overlays: resolution: 4K ``` -### Supress Overlays +### Suppress Overlays -You can add `supress_overlays` to an overlay definition and give it a list or comma separated string of overlay names you want suppressed from this item if this overlay is attached to the item. +You can add `suppress_overlays` to an overlay definition and give it a list or comma separated string of overlay names you want suppressed from this item if this overlay is attached to the item. -So in this example if the `4K-HDR` overlay matches an item then the `4K` and `HDR` overlays will also match. The `supress_overlays` attribute on `4K-HDR` will stop the overlays specified (`4K` and `HDR`) from also being applied. +So in this example if the `4K-HDR` overlay matches an item then the `4K` and `HDR` overlays will also match. The `suppress_overlays` attribute on `4K-HDR` will stop the overlays specified (`4K` and `HDR`) from also being applied. ```yaml overlays: @@ -104,7 +104,7 @@ overlays: all: hdr: true 4K-HDR: - supress_overlays: + suppress_overlays: - 4K - HDR plex_search: diff --git a/modules/builder.py b/modules/builder.py index 1e3e99b2..22159c5d 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -97,7 +97,7 @@ boolean_details = [ scheduled_boolean = ["visible_library", "visible_home", "visible_shared"] string_details = ["sort_title", "content_rating", "name_mapping"] ignored_details = [ - "smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "supress_overlays", + "smart_filter", "smart_label", "smart_url", "run_again", "schedule", "sync_mode", "template", "test", "suppress_overlays", "delete_not_scheduled", "tmdb_person", "build_collection", "collection_order", "collection_level", "overlay", "validate_builders", "libraries", "sync_to_users", "collection_name", "playlist_name", "name", "blank_collection" ] @@ -190,7 +190,7 @@ custom_sort_builders = [ "mal_popular", "mal_favorite", "mal_suggested", "mal_userlist", "mal_season", "mal_genre", "mal_studio" ] episode_parts_only = ["plex_pilots"] -overlay_only = ["overlay", "supress_overlays"] +overlay_only = ["overlay", "suppress_overlays"] overlay_attributes = [ "filters", "limit", "show_missing", "save_missing", "missing_only_released", "minimum_items", "cache_builders", "tmdb_region" ] + all_builders + overlay_only @@ -264,7 +264,7 @@ class CollectionBuilder: self.data[attr] = new_attributes[attr] methods[attr.lower()] = attr - self.supress_overlays = [] + self.suppress_overlays = [] if self.overlay: if "overlay" in methods: logger.debug("") @@ -308,14 +308,14 @@ class CollectionBuilder: if self.overlay != "blur" and not os.path.exists(overlay_path): raise Failed(f"{self.Type} Error: Overlay Image not found at: {overlay_path}") - if "supress_overlays" in methods: + if "suppress_overlays" in methods: logger.debug("") - logger.debug("Validating Method: supress_overlays") - logger.debug(f"Value: {data[methods['supress_overlays']]}") - if data[methods["supress_overlays"]]: - self.supress_overlays = util.get_list(data[methods["supress_overlays"]]) + logger.debug("Validating Method: suppress_overlays") + logger.debug(f"Value: {data[methods['suppress_overlays']]}") + if data[methods["suppress_overlays"]]: + self.suppress_overlays = util.get_list(data[methods["suppress_overlays"]]) else: - logger.error(f"{self.Type} Error: supress_overlays attribute is blank") + logger.error(f"{self.Type} Error: suppress_overlays attribute is blank") if self.playlist: if "libraries" in methods: diff --git a/modules/meta.py b/modules/meta.py index bad9912f..86ef772b 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -296,8 +296,16 @@ class MetadataFile(DataFile): raise Failed(f"Config Error: {map_name} type attribute: {dynamic[methods['type']]} requires trakt to be configured") else: auto_type = dynamic[methods["type"]].lower() - og_exclude = util.parse("Config", "exclude", dynamic, parent=map_name, methods=methods, datatype="strlist") if "exclude" in methods else [] - include = util.parse("Config", "include", dynamic, parent=map_name, methods=methods, datatype="strlist") if "include" in methods else [] + og_exclude = [] + if "exclude" in self.temp_vars: + og_exclude = util.parse("Config", "exclude", self.temp_vars["exclude"], parent="template_variable", datatype="strlist") + elif "exclude" in methods: + og_exclude = util.parse("Config", "exclude", dynamic, parent=map_name, methods=methods, datatype="strlist") + include = [] + if "include" in self.temp_vars: + include = util.parse("Config", "include", self.temp_vars["include"], parent="template_variable", datatype="strlist") + elif "include" in methods: + include = util.parse("Config", "include", dynamic, parent=map_name, methods=methods, datatype="strlist") addons = util.parse("Config", "addons", dynamic, parent=map_name, methods=methods, datatype="dictliststr") if "addons" in methods else {} exclude = [str(e) for e in og_exclude] for k, v in addons.items(): @@ -461,7 +469,9 @@ class MetadataFile(DataFile): else: logger.warning(f"Config Error: {add_key} Custom Key must have at least one Key") title_format = default_title_format - if "title_format" in methods: + if "title_format" in self.temp_vars: + title_format = util.parse("Config", "title_format", self.temp_vars["title_format"], parent="template_variable", default=default_title_format) + elif "title_format" in methods: title_format = util.parse("Config", "title_format", dynamic, parent=map_name, methods=methods, default=default_title_format) if "<>" not in title_format and "<>" not in title_format: logger.error(f"Config Error: <<key_name>> not in title_format: {title_format} using default: {default_title_format}") @@ -490,10 +500,22 @@ class MetadataFile(DataFile): else: self.templates[map_name] = default_template if default_template else default_templates[auto_type] template_names = [map_name] - 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 [] + remove_prefix = [] + if "remove_prefix" in self.temp_vars: + remove_prefix = util.parse("Config", "remove_prefix", self.temp_vars["remove_prefix"], parent="template_variable", datatype="commalist") + elif "remove_prefix" in methods: + remove_prefix = util.parse("Config", "remove_prefix", dynamic, parent=map_name, methods=methods, datatype="commalist") + remove_suffix = [] + if "remove_suffix" in self.temp_vars: + remove_suffix = util.parse("Config", "remove_suffix", self.temp_vars["remove_suffix"], parent="template_variable", datatype="commalist") + elif "remove_suffix" in methods: + remove_suffix = util.parse("Config", "remove_suffix", dynamic, parent=map_name, methods=methods, datatype="commalist") 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_name", dynamic, parent=map_name, methods=methods) if "other_name" in methods and include else None + other_name = None + if "other_name" in self.temp_vars and include: + other_name = util.parse("Config", "other_name", self.temp_vars["remove_suffix"], parent="template_variable") + elif "other_name" in methods and include: + other_name = util.parse("Config", "other_name", dynamic, parent=map_name, methods=methods) other_templates = util.parse("Config", "other_template", dynamic, parent=map_name, methods=methods, datatype="strlist") if "other_template" in methods and include else None if other_templates: for other_template in other_templates: diff --git a/modules/overlays.py b/modules/overlays.py index 8517453f..d5673a6f 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -58,11 +58,11 @@ class Overlays: if item.ratingKey not in overlay_to_keys[builder.overlay]: overlay_to_keys[builder.overlay].append(item.ratingKey) - if builder.supress_overlays: + if builder.suppress_overlays: for rk in overlay_to_keys[builder.overlay]: - for supress_overlay in builder.supress_overlays: - if supress_overlay in overlay_to_keys and rk in overlay_to_keys[supress_overlay]: - overlay_to_keys[supress_overlay].remove(rk) + for suppress_overlay in builder.suppress_overlays: + if suppress_overlay in overlay_to_keys and rk in overlay_to_keys[suppress_overlay]: + overlay_to_keys[suppress_overlay].remove(rk) except Failed as e: logger.error(e)