From aed98d5c3f4dc27fad08bb51893e8037ecbc3d83 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 15 May 2024 16:52:32 -0400 Subject: [PATCH] [15] fix template calls --- VERSION | 2 +- docs/defaults/both/genre.md | 8 ++++---- modules/meta.py | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/VERSION b/VERSION index 04f5fbf2..aee321a4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.1-develop14 +2.0.1-develop15 diff --git a/docs/defaults/both/genre.md b/docs/defaults/both/genre.md index 2e14eb54..712f334c 100644 --- a/docs/defaults/both/genre.md +++ b/docs/defaults/both/genre.md @@ -12,10 +12,10 @@ Supported Library Types: Movie, Show ## Collections Section 060 -| Collection | Key | Description | -|:---------------------------------------------------------|:---------------------------------|:-------------------------------------------------------------------------------| -| `Genre Collections` | `separator` | [Separator Collection](../separators.md) to denote the Section of Collections. | -| `<> Movies/Shows`
**Example:** `Action Movies` | `<>`
**Example:** `5` | Collection of Movies/Shows that have this Genre. | +| Collection | Key | Description | +|:---------------------------------------------------------|:-------------------------------------|:-------------------------------------------------------------------------------| +| `Genre Collections` | `separator` | [Separator Collection](../separators.md) to denote the Section of Collections. | +| `<> Movies/Shows`
**Example:** `Action Movies` | `<>`
**Example:** `Action` | Collection of Movies/Shows that have this Genre. | ## Config diff --git a/modules/meta.py b/modules/meta.py index e055b3f2..b407b7a4 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -507,14 +507,14 @@ class DataFile: logger.trace("") def check_for_var(_method, _data, _debug): - def scan_text(og_txt, var, actual_value): + def scan_text(og_txt, var, actual_value, second=False): if og_txt is None: return og_txt elif str(og_txt) == f"<<{var}>>": return actual_value elif f"<<{var}" in str(og_txt): final = str(og_txt).replace(f"<<{var}>>", str(actual_value)) if f"<<{var}>>" in str(og_txt) else str(og_txt) - if f"<<{var}" in final and var not in variables: + if f"<<{var}" in final and second: match = re.search(f"<<({var}([+-])(\\d+))>>", final) if match: try: @@ -532,13 +532,14 @@ class DataFile: for option in optional: if option not in variables and f"<<{option}>>" in str(_data): raise Failed - for variable, variable_data in variables.items(): - if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]: - _data = scan_text(_data, variable, variable_data.replace(",", "")) - elif (variable == "name_format" and _method != "name") or (variable == "summary_format" and _method != "summary"): - continue - elif variable != "name" and (_method not in ["name", "summary"] or variable != "key_name"): - _data = scan_text(_data, variable, variable_data) + for option in [False, True]: + for variable, variable_data in variables.items(): + if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]: + _data = scan_text(_data, variable, variable_data.replace(",", ""), second=option) + elif (variable == "name_format" and _method != "name") or (variable == "summary_format" and _method != "summary"): + continue + elif variable != "name" and (_method not in ["name", "summary"] or variable != "key_name"): + _data = scan_text(_data, variable, variable_data, second=option) for dm, dd in default.items(): if (dm == "name_format" and _method != "name") or (dm == "summary_format" and _method != "summary"): continue