mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-26 14:30:25 +00:00
[22] update conditions
This commit is contained in:
parent
0026e284b6
commit
9c2fd7e064
3 changed files with 28 additions and 30 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
1.18.3-develop21
|
1.18.3-develop22
|
||||||
|
|
|
@ -46,11 +46,13 @@ extensions = [
|
||||||
'myst_parser',
|
'myst_parser',
|
||||||
'sphinx_inline_tabs',
|
'sphinx_inline_tabs',
|
||||||
'sphinx_copybutton',
|
'sphinx_copybutton',
|
||||||
'sphinx_reredirects'
|
'sphinx_reredirects',
|
||||||
|
'sphinx_design'
|
||||||
]
|
]
|
||||||
|
|
||||||
source_suffix = ['.rst', '.md']
|
source_suffix = ['.rst', '.md']
|
||||||
myst_heading_anchors = 4
|
myst_heading_anchors = 4
|
||||||
|
myst_enable_extensions = ["colon_fence"]
|
||||||
|
|
||||||
# -- Napoleon Settings -----------------------------------------------------
|
# -- Napoleon Settings -----------------------------------------------------
|
||||||
napoleon_google_docstring = True
|
napoleon_google_docstring = True
|
||||||
|
@ -545,7 +547,7 @@ html_static_path = ["_static"]
|
||||||
|
|
||||||
html_css_files = [
|
html_css_files = [
|
||||||
"custom.css",
|
"custom.css",
|
||||||
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
|
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"
|
||||||
]
|
]
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
|
|
@ -377,39 +377,35 @@ class DataFile:
|
||||||
for var_key, var_value in condition.items():
|
for var_key, var_value in condition.items():
|
||||||
if var_key == "value":
|
if var_key == "value":
|
||||||
continue
|
continue
|
||||||
|
error_text = ""
|
||||||
var_key = replace_var(var_key, [variables, default])
|
var_key = replace_var(var_key, [variables, default])
|
||||||
var_value = replace_var(var_value, [variables, default])
|
var_value = replace_var(var_value, [variables, default])
|
||||||
if var_key.endswith(".exists"):
|
if var_key.endswith(".exists"):
|
||||||
var_value = util.parse(self.data_type, var_key, var_value, datatype="bool", default=False)
|
con_value = util.parse(self.data_type, var_key, var_value, datatype="bool", default=False)
|
||||||
if (not var_value and var_key[:-7] in variables and variables[var_key[:-7]]) or (var_value and (var_key[:-7] not in variables or not variables[var_key[:-7]])):
|
if con_value:
|
||||||
logger.trace(f"Condition {i} Failed: {var_key}: {'true does not exist' if var_value else 'false exists'}")
|
if var_key[:-7] not in variables or not variables[var_key[:-7]]:
|
||||||
condition_passed = False
|
error_text = "- does not exist"
|
||||||
|
elif var_key[:-7] in variables and variables[var_key[:-7]]:
|
||||||
|
error_text = "- exists"
|
||||||
elif var_key.endswith(".not"):
|
elif var_key.endswith(".not"):
|
||||||
if (isinstance(var_value, list) and variables[var_key[:-4]] in var_value) or \
|
if var_key[:-4] in variables:
|
||||||
(not isinstance(var_value, list) and str(variables[var_key[:-4]]) == str(var_value)):
|
con_value = variables[var_key[:-4]]
|
||||||
if isinstance(var_value, list):
|
if isinstance(var_value, list):
|
||||||
logger.trace(f'Condition {i} Failed: {var_key[:-4]} "{variables[var_key[:-4]]}" in {var_value}')
|
if con_value in var_value:
|
||||||
else:
|
error_text = f'in {var_value}'
|
||||||
logger.trace(f'Condition {i} Failed: {var_key[:-4]} "{variables[var_key[:-4]]}" is "{var_value}"')
|
elif str(con_value) == str(var_value):
|
||||||
condition_passed = False
|
error_text = f'is "{var_value}"'
|
||||||
elif var_key in variables:
|
elif var_key in variables or var_key in default:
|
||||||
if (isinstance(var_value, list) and variables[var_key] not in var_value) or \
|
con_value = variables[var_key] if var_key in variables else default[var_key]
|
||||||
(not isinstance(var_value, list) and str(variables[var_key]) != str(var_value)):
|
if isinstance(var_value, list):
|
||||||
if isinstance(var_value, list):
|
if con_value not in var_value:
|
||||||
logger.trace(f'Condition {i} Failed: {var_key} "{variables[var_key]}" not in {var_value}')
|
error_text = f'not in {var_value}'
|
||||||
else:
|
elif str(con_value) != str(var_value):
|
||||||
logger.trace(f'Condition {i} Failed: {var_key} "{variables[var_key]}" is not "{var_value}"')
|
error_text = f'is not "{var_value}"'
|
||||||
condition_passed = False
|
|
||||||
elif var_key in default:
|
|
||||||
if (isinstance(var_value, list) and default[var_key] not in var_value) or \
|
|
||||||
(not isinstance(var_value, list) and str(default[var_key]) != str(var_value)):
|
|
||||||
if isinstance(var_value, list):
|
|
||||||
logger.trace(f'Condition {i} Failed: {var_key} "{default[var_key]}" not in {var_value}')
|
|
||||||
else:
|
|
||||||
logger.trace(f'Condition {i} Failed: {var_key} "{default[var_key]}" is not "{var_value}"')
|
|
||||||
condition_passed = False
|
|
||||||
else:
|
else:
|
||||||
logger.trace(f"Condition {i} Failed: {var_key} is not a variable provided or a default variable")
|
error_text = "is not a variable provided or a default variable"
|
||||||
|
if error_text:
|
||||||
|
logger.trace(f'Condition {i} Failed: {var_key}: "{con_value}" {error_text}')
|
||||||
condition_passed = False
|
condition_passed = False
|
||||||
if condition_passed:
|
if condition_passed:
|
||||||
logger.debug(f'Conditional Variable: {final_key} is "{condition["value"]}"')
|
logger.debug(f'Conditional Variable: {final_key} is "{condition["value"]}"')
|
||||||
|
|
Loading…
Reference in a new issue