mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
[12] allow template operations
This commit is contained in:
parent
0afb243335
commit
2311ebd3f9
2 changed files with 11 additions and 3 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.18.2-develop11
|
||||
1.18.2-develop12
|
||||
|
|
|
@ -474,8 +474,16 @@ class DataFile:
|
|||
return og_txt
|
||||
elif str(og_txt) == f"<<{var}>>":
|
||||
return actual_value
|
||||
elif f"<<{var}>>" in str(og_txt):
|
||||
return str(og_txt).replace(f"<<{var}>>", str(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:
|
||||
match = re.search(f"<<({var}([+-])(\d+))>>", final)
|
||||
if match:
|
||||
try:
|
||||
final = final.replace(f"<<{match.group(1)}>>", str(int(actual_value) + (int(match.group(3)) * (-1 if match.group(2) == "-" else 1))))
|
||||
except ValueError:
|
||||
raise Failed(f"Template Error: {actual_value} must be a number to use {match.group(1)}")
|
||||
return final
|
||||
else:
|
||||
return og_txt
|
||||
if _debug:
|
||||
|
|
Loading…
Reference in a new issue