From 08c1a53f0f3a2bf4bd68885ee21e836bd05d4d8f Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Wed, 1 Jun 2022 16:01:40 -0400 Subject: [PATCH] [14] minor fixes --- VERSION | 2 +- modules/builder.py | 36 +++++++++++++++++++----------------- modules/config.py | 3 ++- modules/plex.py | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/VERSION b/VERSION index 3ba82ef3..419ed4b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.0-develop13 +1.17.0-develop14 diff --git a/modules/builder.py b/modules/builder.py index 8e3f4ea3..589bd947 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1851,7 +1851,25 @@ class CollectionBuilder: def validate_attribute(self, attribute, modifier, final, data, validate, plex_search=False): def smart_pair(list_to_pair): return [(t, t) for t in list_to_pair] if plex_search else list_to_pair - if modifier == ".regex" and not plex_search: + if attribute in plex.tag_attributes and modifier in [".regex"]: + _, names = self.library.get_search_choices(attribute, title=not plex_search, name_pairs=True) + valid_list = [] + used = [] + for reg in util.validate_regex(data, self.Type, validate=validate): + for name, key in names: + if name not in used and re.compile(reg).search(name): + used.append(name) + valid_list.append((name, key) if plex_search else key) + if not valid_list: + error = f"Plex Error: {attribute}: No matches found with regex pattern {data}" + if self.details["show_options"]: + error += f"\nOptions: {names}" + if validate: + raise Failed(error) + else: + logger.error(error) + return valid_list + elif modifier == ".regex": return util.validate_regex(data, self.Type, validate=validate) elif attribute in plex.string_attributes + string_filters and modifier in ["", ".not", ".is", ".isnot", ".begins", ".ends"]: return smart_pair(util.get_list(data, split=False)) @@ -1873,22 +1891,6 @@ class CollectionBuilder: return util.parse(self.Type, final, data, datatype="commalist", options=[v for k, v in discover_types.items()]) elif attribute == "tmdb_status": return util.parse(self.Type, final, data, datatype="commalist", options=[v for k, v in discover_status.items()]) - elif attribute in plex.tag_attributes and modifier in [".regex"]: - _, names = self.library.get_search_choices(attribute, title=not plex_search, name_pairs=True) - valid_list = [] - used = [] - if plex_search and modifier == ".regex": - for reg in util.validate_regex(data, self.Type, validate=validate): - for name, key in names: - if name not in used and re.compile(reg).search(name): - valid_list.append((name, key) if plex_search else key) - if not valid_list: - error = f"Plex Error: {attribute}: No matches found with regex pattern {data}" - if validate: - raise Failed(error) - else: - logger.error(error) - return valid_list elif attribute in plex.tag_attributes and modifier in ["", ".not"]: if attribute in plex.tmdb_attributes: final_values = [] diff --git a/modules/config.py b/modules/config.py index 6c85f2c0..9d77eb57 100644 --- a/modules/config.py +++ b/modules/config.py @@ -787,7 +787,7 @@ class ConfigFile: raise NotScheduled(f"{err}\n\nOverlays not scheduled to run") params["overlay_path"] = files except NotScheduled as e: - logger.error(e) + logger.info(e) params["overlay_path"] = [] params["remove_overlays"] = False @@ -802,6 +802,7 @@ class ConfigFile: "optimize": check_for_attribute(lib, "optimize", parent="plex", var_type="bool", default=self.general["plex"]["optimize"], save=False) } library = Plex(self, params) + logger.info("") logger.info(f"{display_name} Library Connection Successful") logger.info("") logger.separator("Scanning Metadata and Overlay Files", space=False, border=False) diff --git a/modules/plex.py b/modules/plex.py index ff3773ae..718d9fe7 100644 --- a/modules/plex.py +++ b/modules/plex.py @@ -1027,7 +1027,7 @@ class Plex(Library): break if not item_asset_directory: extra = "" - if self.create_asset_folders and self.asset_folders: + if self.create_asset_folders and self.asset_folders and asset_directory: item_asset_directory = os.path.join(asset_directory[0], folder_name) os.makedirs(item_asset_directory, exist_ok=True) extra = f"\nAsset Directory Created: {item_asset_directory}"