|
|
@ -1,4 +1,4 @@
|
|
|
|
import math, operator, os, re, requests
|
|
|
|
import math, operator, os, re
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime
|
|
|
|
from modules import plex, ergast, util
|
|
|
|
from modules import plex, ergast, util
|
|
|
|
from modules.util import Failed, NotScheduled, YAML
|
|
|
|
from modules.util import Failed, NotScheduled, YAML
|
|
|
@ -329,14 +329,14 @@ class DataFile:
|
|
|
|
default = {}
|
|
|
|
default = {}
|
|
|
|
if all_init_defaults:
|
|
|
|
if all_init_defaults:
|
|
|
|
var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in all_init_defaults.items() if dk not in variables}
|
|
|
|
var_default = {replace_var(dk, variables): replace_var(dv, variables) for dk, dv in all_init_defaults.items() if dk not in variables}
|
|
|
|
for dkey, dvalue in var_default.items():
|
|
|
|
for d_key, d_value in var_default.items():
|
|
|
|
final_key = replace_var(dkey, var_default)
|
|
|
|
final_key = replace_var(d_key, var_default)
|
|
|
|
if final_key not in optional and final_key not in variables and final_key not in conditionals:
|
|
|
|
if final_key not in optional and final_key not in variables and final_key not in conditionals:
|
|
|
|
default[final_key] = dvalue
|
|
|
|
default[final_key] = d_value
|
|
|
|
if "<<" in str(dvalue):
|
|
|
|
if "<<" in str(d_value):
|
|
|
|
default[f"{final_key}_encoded"] = re.sub(r'<<(.+)>>', r'<<\1_encoded>>', dvalue)
|
|
|
|
default[f"{final_key}_encoded"] = re.sub(r'<<(.+)>>', r'<<\1_encoded>>', d_value)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
default[f"{final_key}_encoded"] = util.quote(dvalue)
|
|
|
|
default[f"{final_key}_encoded"] = util.quote(d_value)
|
|
|
|
|
|
|
|
|
|
|
|
if "optional" in template:
|
|
|
|
if "optional" in template:
|
|
|
|
if template["optional"]:
|
|
|
|
if template["optional"]:
|
|
|
@ -483,7 +483,7 @@ class DataFile:
|
|
|
|
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:
|
|
|
|
if f"<<{var}" in final:
|
|
|
|
match = re.search(f"<<({var}([+-])(\d+))>>", final)
|
|
|
|
match = re.search(f"<<({var}([+-])(\\d+))>>", final)
|
|
|
|
if match:
|
|
|
|
if match:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
final = final.replace(f"<<{match.group(1)}>>", str(int(actual_value) + (int(match.group(3)) * (-1 if match.group(2) == "-" else 1))))
|
|
|
|
final = final.replace(f"<<{match.group(1)}>>", str(int(actual_value) + (int(match.group(3)) * (-1 if match.group(2) == "-" else 1))))
|
|
|
@ -664,7 +664,7 @@ class MetadataFile(DataFile):
|
|
|
|
raise Failed(f"Image Section Error: No styles found for section: {section_key}")
|
|
|
|
raise Failed(f"Image Section Error: No styles found for section: {section_key}")
|
|
|
|
use_key = None
|
|
|
|
use_key = None
|
|
|
|
if f"use_{section_key}" in methods:
|
|
|
|
if f"use_{section_key}" in methods:
|
|
|
|
use_key = util.parse("Images", f"use_{section_key}", self.temp_vars, datatype="bool",methods=methods, default=False)
|
|
|
|
use_key = util.parse("Images", f"use_{section_key}", self.temp_vars, datatype="bool", methods=methods, default=False)
|
|
|
|
logger.info(f"Use {section_key}: {use_key}")
|
|
|
|
logger.info(f"Use {section_key}: {use_key}")
|
|
|
|
if use_key is False:
|
|
|
|
if use_key is False:
|
|
|
|
logger.trace(f"Skipped as use_{section_key} is false")
|
|
|
|
logger.trace(f"Skipped as use_{section_key} is false")
|
|
|
@ -842,7 +842,7 @@ class MetadataFile(DataFile):
|
|
|
|
all_keys = {}
|
|
|
|
all_keys = {}
|
|
|
|
auto_list = {}
|
|
|
|
auto_list = {}
|
|
|
|
for i in tags:
|
|
|
|
for i in tags:
|
|
|
|
final_title = self.config.TMDb.TMDb._iso_639_1[str(i.key)].english_name if str(i.key) in self.config.TMDb.TMDb._iso_639_1 else str(i.title)
|
|
|
|
final_title = self.config.TMDb.TMDb._iso_639_1[str(i.key)].english_name if str(i.key) in self.config.TMDb.TMDb._iso_639_1 else str(i.title) # noqa
|
|
|
|
all_keys[str(i.key)] = final_title
|
|
|
|
all_keys[str(i.key)] = final_title
|
|
|
|
if all([x not in exclude for x in [final_title, str(i.title), str(i.key)]]):
|
|
|
|
if all([x not in exclude for x in [final_title, str(i.title), str(i.key)]]):
|
|
|
|
auto_list[str(i.key)] = final_title
|
|
|
|
auto_list[str(i.key)] = final_title
|
|
|
@ -1555,7 +1555,7 @@ class MetadataFile(DataFile):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
values = [loc for loc in i.locations if loc]
|
|
|
|
values = [loc for loc in i.locations if loc]
|
|
|
|
if not values:
|
|
|
|
if not values:
|
|
|
|
raise Failed(f"Plex Error: No Filepaths found for {i.title}")
|
|
|
|
raise Failed(f"Plex Error: No Filepaths found for {i.title}")
|
|
|
|
res = re.search(r'(?i)[\[{]edition-([^}\]]*)', values[0])
|
|
|
|
res = re.search(r'(?i)[\[{]edition-([^}\]]*)', values[0])
|
|
|
|
check = res.group(1) if res else ""
|
|
|
|
check = res.group(1) if res else ""
|
|
|
|
if blank_edition and not check:
|
|
|
|
if blank_edition and not check:
|
|
|
|