diff --git a/VERSION b/VERSION index 5a183b77..4dd21059 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0-develop37 +1.18.0-develop38 diff --git a/defaults/movie/seasonal.yml b/defaults/movie/seasonal.yml index 2c86d6fa..5af5e7a3 100644 --- a/defaults/movie/seasonal.yml +++ b/defaults/movie/seasonal.yml @@ -144,9 +144,9 @@ dynamic_collections: tmdb_movie: halloween: - 23437 # A Nightmare on Elm Street (2010) - visible_home_<>: + visible_home: default: true - visible_shared_<>: + visible_shared: default: true image: default: seasonal/<> diff --git a/defaults/show/content_rating_us.yml b/defaults/show/content_rating_us.yml index bf817fad..70ad1994 100644 --- a/defaults/show/content_rating_us.yml +++ b/defaults/show/content_rating_us.yml @@ -70,6 +70,8 @@ dynamic_collections: - "05" - "06" - G - All Ages + - A + - no/A TV-Y: - TV-Y7 - TV-Y7-FV @@ -79,6 +81,12 @@ dynamic_collections: - "07" - "08" - "09" + - no/5 + - no/05 + - no/6 + - no/06 + - no/7 + - no/07 TV-PG: - gb/PG - gb/9+ @@ -87,6 +95,11 @@ dynamic_collections: - 12 - 13 - PG - Children + - no/9 + - no/09 + - no/10 + - no/11 + - no/12 TV-14: - gb/12A - 12+ @@ -99,6 +112,8 @@ dynamic_collections: - 16 - 17 - PG-13 - Teens 13 or older + - no/15 + - no/16 TV-MA: - 18 - gb/18 @@ -109,3 +124,4 @@ dynamic_collections: - R - 17+ (violence & profanity) - R+ - Mild Nudity - Rx - Hentai + - no/18 diff --git a/defaults/templates.yml b/defaults/templates.yml index 37232024..65a09983 100644 --- a/defaults/templates.yml +++ b/defaults/templates.yml @@ -42,13 +42,16 @@ templates: item_sonarr_tag_<>: <> url_poster: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Images/master/<>.jpg url_poster_<>: <> + visible_library_<>: <> + visible_home_<>: <> + visible_shared_<>: <> optional: - use_<> - allowed_libraries - collection_mode - - visible_library_<> - - visible_home_<> - - visible_shared_<> + - visible_library + - visible_home + - visible_shared - item_radarr_tag - item_sonarr_tag - trakt_list diff --git a/modules/meta.py b/modules/meta.py index 7063e930..534e9bb7 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -195,31 +195,31 @@ class DataFile: raise Failed(f"{self.data_type} Error: template attribute is blank") else: new_attributes = {} - for variables in util.get_list(template_call, split=False): - if not isinstance(variables, dict): + for original_variables in util.get_list(template_call, split=False): + if not isinstance(original_variables, dict): raise Failed(f"{self.data_type} Error: template attribute is not a dictionary") - elif "name" not in variables: + elif "name" not in original_variables: raise Failed(f"{self.data_type} Error: template sub-attribute name is required") - elif not variables["name"]: + elif not original_variables["name"]: raise Failed(f"{self.data_type} Error: template sub-attribute name is blank") - elif variables["name"] not in self.templates: - raise Failed(f"{self.data_type} Error: template {variables['name']} not found") - elif not isinstance(self.templates[variables["name"]][0], dict): - raise Failed(f"{self.data_type} Error: template {variables['name']} is not a dictionary") + elif original_variables["name"] not in self.templates: + raise Failed(f"{self.data_type} Error: template {original_variables['name']} not found") + elif not isinstance(self.templates[original_variables["name"]][0], dict): + raise Failed(f"{self.data_type} Error: template {original_variables['name']} is not a dictionary") else: - logger.separator(f"Template {variables['name']}", space=False, border=False, debug=True) + logger.separator(f"Template {original_variables['name']}", space=False, border=False, debug=True) logger.trace("") - logger.trace(f"Call: {variables}") + logger.trace(f"Original: {original_variables}") remove_variables = [] optional = [] - for tm in variables: - if variables[tm] is None: + for tm in original_variables: + if original_variables[tm] is None: remove_variables.append(tm) - variables.pop(tm) + original_variables.pop(tm) optional.append(str(tm)) - template, temp_vars = self.templates[variables["name"]] + template, temp_vars = self.templates[original_variables["name"]] if call_name: name = call_name @@ -229,11 +229,23 @@ class DataFile: name = mapping_name name_var = f"{self.data_type.lower()}_name" - variables[name_var] = str(name) - variables["mapping_name"] = mapping_name - variables["library_type"] = self.library.type.lower() if self.library else "item" - variables["library_typeU"] = self.library.type if self.library else "Item" - variables["library_name"] = self.library.name if self.library else "playlist" + original_variables[name_var] = str(name) + original_variables["mapping_name"] = mapping_name + original_variables["library_type"] = self.library.type.lower() if self.library else "item" + original_variables["library_typeU"] = self.library.type if self.library else "Item" + original_variables["library_name"] = self.library.name if self.library else "playlist" + + def replace_var(input_item, search_dicts): + if not isinstance(search_dicts, list): + search_dicts = [search_dicts] + return_item = input_item + for search_dict in search_dicts: + for rk, rv in search_dict.items(): + if f"<<{rk}>>" == str(return_item): + return_item = rv + if f"<<{rk}>>" in str(return_item): + return_item = str(return_item).replace(f"<<{rk}>>", str(rv)) + return return_item conditionals = {} if "conditionals" in template: @@ -254,8 +266,10 @@ class DataFile: init_defaults = template["default"] all_init_defaults = {k: v for k, v in init_defaults.items()} + variables = {} temp_conditionals = {} for input_dict, input_type, overwrite_call in [ + (original_variables, "Call", False), (temp_vars, "External", False), (extra_variables, "Definition", False), (self.temp_vars, "Config", True) @@ -277,16 +291,18 @@ class DataFile: raise Failed(f"{self.data_type} Error: {input_type} template sub-attribute default is not a dictionary") for dk, dv in input_value.items(): all_init_defaults[dk] = dv - elif input_value is None: - optional.append(str(input_key)) - if input_key in variables: - variables.pop(input_key) - if input_key in added_vars: - added_vars.pop(input_key) - elif overwrite_call: - variables[input_key] = input_value else: - added_vars[input_key] = input_value + input_key = replace_var(input_key, original_variables) + if input_value is None: + optional.append(str(input_key)) + if input_key in variables: + variables.pop(input_key) + if input_key in added_vars: + added_vars.pop(input_key) + elif overwrite_call: + variables[input_key] = input_value + else: + added_vars[input_key] = input_value for k, v in added_vars.items(): if k not in variables: variables[k] = v @@ -312,18 +328,6 @@ class DataFile: variables["key_name"] = key_name_variables[variables["key_name"]] variables["translated_key_name"] = variables["key_name"] - def replace_var(input_item, search_dicts): - if not isinstance(search_dicts, list): - search_dicts = [search_dicts] - return_item = input_item - for search_dict in search_dicts: - for rk, rv in search_dict.items(): - if f"<<{rk}>>" == str(return_item): - return_item = rv - if f"<<{rk}>>" in str(return_item): - return_item = str(return_item).replace(f"<<{rk}>>", str(rv)) - return return_item - default = {} if all_init_defaults: var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in all_init_defaults.items() if dk not in variables} diff --git a/modules/operations.py b/modules/operations.py index f66371ed..113e4583 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -520,7 +520,7 @@ class Operations: logger.info(f"Background | No Reset Image Found") if self.library.is_show: - real_show = tmdb_item.load_show() if tmdb_item else None + real_show = tmdb_item.load_show() if tmdb_item else None tmdb_seasons = {s.season_number: s for s in real_show.seasons} if real_show else {} for season in self.library.query(item.seasons): try: