pull/160/head
meisnate12 4 years ago
parent fac03aab3a
commit 07821cff0e

@ -188,7 +188,7 @@ class CollectionBuilder:
else: else:
for tm in data_template: for tm in data_template:
if not data_template[tm]: if not data_template[tm]:
raise Failed(f"Collection Error: template sub-attribute {data_template[tm]} is blank") raise Failed(f"Collection Error: template sub-attribute {tm} is blank")
template_name = data_template["name"] template_name = data_template["name"]
template = self.library.templates[template_name] template = self.library.templates[template_name]
@ -230,18 +230,22 @@ class CollectionBuilder:
if option not in data_template and f"<<{option}>>" in txt: if option not in data_template and f"<<{option}>>" in txt:
raise Failed("remove attribute") raise Failed("remove attribute")
for template_method in data_template: for template_method in data_template:
if template_method != "name" and f"<<{template_method}>>" in txt: if template_method != "name" and txt == f"<<{template_method}>>":
txt = data_template[template_method]
elif template_method != "name" and f"<<{template_method}>>" in txt:
txt = txt.replace(f"<<{template_method}>>", str(data_template[template_method])) txt = txt.replace(f"<<{template_method}>>", str(data_template[template_method]))
if "<<collection_name>>" in txt: if "<<collection_name>>" in txt:
txt = txt.replace("<<collection_name>>", str(self.name)) txt = txt.replace("<<collection_name>>", str(self.name))
for dm in default: for dm in default:
if f"<<{dm}>>" in txt: if txt == f"<<{dm}>>":
txt = default[dm]
elif f"<<{dm}>>" in txt:
txt = txt.replace(f"<<{dm}>>", str(default[dm])) txt = txt.replace(f"<<{dm}>>", str(default[dm]))
if txt in ["true", "True"]: return True if txt in ["true", "True"]: return True
elif txt in ["false", "False"]: return False elif txt in ["false", "False"]: return False
else: else:
try: return int(txt) try: return int(txt)
except ValueError: return txt except (ValueError, TypeError): return txt
try: try:
if isinstance(attr_data, dict): if isinstance(attr_data, dict):
final_data = {} final_data = {}

@ -190,7 +190,7 @@ class PlexAPI:
if str(value).lower() in search_choices: if str(value).lower() in search_choices:
valid_list.append(search_choices[str(value).lower()]) valid_list.append(search_choices[str(value).lower()])
else: else:
raise Failed(f"Plex Error: {search_name}: {value} not found") logger.error(f"Plex Error: {search_name}: {value} not found")
return valid_list return valid_list
def get_all_collections(self): def get_all_collections(self):

Loading…
Cancel
Save