From 07821cff0ecf24256bd18ab2e0fc3934d7486dd3 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 30 Mar 2021 16:50:34 -0400 Subject: [PATCH] fix for #151 --- modules/builder.py | 12 ++++++++---- modules/plex.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/builder.py b/modules/builder.py index 0668013e..bf41d897 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -188,7 +188,7 @@ class CollectionBuilder: else: for tm in data_template: 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 = self.library.templates[template_name] @@ -230,18 +230,22 @@ class CollectionBuilder: if option not in data_template and f"<<{option}>>" in txt: raise Failed("remove attribute") 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])) if "<>" in txt: txt = txt.replace("<>", str(self.name)) 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])) if txt in ["true", "True"]: return True elif txt in ["false", "False"]: return False else: try: return int(txt) - except ValueError: return txt + except (ValueError, TypeError): return txt try: if isinstance(attr_data, dict): final_data = {} diff --git a/modules/plex.py b/modules/plex.py index 34ad6c13..f242b563 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -190,7 +190,7 @@ class PlexAPI: if str(value).lower() in search_choices: valid_list.append(search_choices[str(value).lower()]) else: - raise Failed(f"Plex Error: {search_name}: {value} not found") + logger.error(f"Plex Error: {search_name}: {value} not found") return valid_list def get_all_collections(self):