[15] fix template calls

This commit is contained in:
meisnate12 2024-05-15 16:52:32 -04:00
parent d7468c3062
commit aed98d5c3f
3 changed files with 15 additions and 14 deletions

View file

@ -1 +1 @@
2.0.1-develop14 2.0.1-develop15

View file

@ -12,10 +12,10 @@ Supported Library Types: Movie, Show
## Collections Section 060 ## Collections Section 060
| Collection | Key | Description | | Collection | Key | Description |
|:---------------------------------------------------------|:---------------------------------|:-------------------------------------------------------------------------------| |:---------------------------------------------------------|:-------------------------------------|:-------------------------------------------------------------------------------|
| `Genre Collections` | `separator` | [Separator Collection](../separators.md) to denote the Section of Collections. | | `Genre Collections` | `separator` | [Separator Collection](../separators.md) to denote the Section of Collections. |
| `<<Genre>> Movies/Shows`<br>**Example:** `Action Movies` | `<<Number>>`<br>**Example:** `5` | Collection of Movies/Shows that have this Genre. | | `<<Genre>> Movies/Shows`<br>**Example:** `Action Movies` | `<<Genre>>`<br>**Example:** `Action` | Collection of Movies/Shows that have this Genre. |
## Config ## Config

View file

@ -507,14 +507,14 @@ class DataFile:
logger.trace("") logger.trace("")
def check_for_var(_method, _data, _debug): 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: if og_txt is None:
return og_txt return og_txt
elif str(og_txt) == f"<<{var}>>": elif str(og_txt) == f"<<{var}>>":
return actual_value return actual_value
elif f"<<{var}" in str(og_txt): 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) 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) match = re.search(f"<<({var}([+-])(\\d+))>>", final)
if match: if match:
try: try:
@ -532,13 +532,14 @@ class DataFile:
for option in optional: for option in optional:
if option not in variables and f"<<{option}>>" in str(_data): if option not in variables and f"<<{option}>>" in str(_data):
raise Failed raise Failed
for variable, variable_data in variables.items(): for option in [False, True]:
if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]: for variable, variable_data in variables.items():
_data = scan_text(_data, variable, variable_data.replace(",", "")) if (variable == "collection_name" or variable == "playlist_name") and _method in ["radarr_tag", "item_radarr_tag", "sonarr_tag", "item_sonarr_tag"]:
elif (variable == "name_format" and _method != "name") or (variable == "summary_format" and _method != "summary"): _data = scan_text(_data, variable, variable_data.replace(",", ""), second=option)
continue elif (variable == "name_format" and _method != "name") or (variable == "summary_format" and _method != "summary"):
elif variable != "name" and (_method not in ["name", "summary"] or variable != "key_name"): continue
_data = scan_text(_data, variable, variable_data) 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(): for dm, dd in default.items():
if (dm == "name_format" and _method != "name") or (dm == "summary_format" and _method != "summary"): if (dm == "name_format" and _method != "name") or (dm == "summary_format" and _method != "summary"):
continue continue