[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
| Collection | Key | Description |
|:---------------------------------------------------------|:---------------------------------|:-------------------------------------------------------------------------------|
| `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. |
| Collection | Key | Description |
|:---------------------------------------------------------|:-------------------------------------|:-------------------------------------------------------------------------------|
| `Genre Collections` | `separator` | [Separator Collection](../separators.md) to denote the Section of Collections. |
| `<<Genre>> Movies/Shows`<br>**Example:** `Action Movies` | `<<Genre>>`<br>**Example:** `Action` | Collection of Movies/Shows that have this Genre. |
## Config

View file

@ -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