From 62d23897b5fe0b648fa0a4ffdc10296e333c999a Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Thu, 4 Aug 2022 16:47:54 -0400 Subject: [PATCH] [21] better plex_search identification --- VERSION | 2 +- modules/builder.py | 17 ++++++++--------- modules/operations.py | 4 +++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 3f3a7554..81124e53 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.2-develop20 +1.17.2-develop21 diff --git a/modules/builder.py b/modules/builder.py index 74399567..ca1a0543 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1956,23 +1956,21 @@ class CollectionBuilder: final_values = util.get_list(data, trim=False) search_choices, names = self.library.get_search_choices(attribute, title=not plex_search) valid_list = [] - for value in final_values: - if str(value).lower() in search_choices: - if plex_search: - valid_list.append((value, search_choices[str(value).lower()])) - else: - valid_list.append(search_choices[str(value).lower()]) + for fvalue in final_values: + if str(fvalue) in search_choices or str(fvalue).lower() in search_choices: + valid_value = search_choices[str(fvalue) if str(fvalue) in search_choices else str(fvalue).lower()] + valid_list.append((fvalue, valid_value) if plex_search else valid_value) else: actor_id = None if attribute in ["actor", "director", "producer", "writer"]: - actor_id = self.library.get_actor_id(value) + actor_id = self.library.get_actor_id(fvalue) if actor_id: if plex_search: - valid_list.append((value, actor_id)) + valid_list.append((fvalue, actor_id)) else: valid_list.append(actor_id) if not actor_id: - error = f"Plex Error: {attribute}: {value} not found" + error = f"Plex Error: {attribute}: {fvalue} not found" if self.details["show_options"]: error += f"\nOptions: {names}" if validate: @@ -2421,6 +2419,7 @@ class CollectionBuilder: def load_collection(self): if self.obj is None and self.smart_url: self.library.create_smart_collection(self.name, self.smart_type_key, self.smart_url) + logger.debug(f"Smart Collection Created: {self.smart_url}") elif self.obj is None and self.blank_collection: self.library.create_blank_collection(self.name) elif self.smart_label_collection: diff --git a/modules/operations.py b/modules/operations.py index 15024604..d67f0dae 100644 --- a/modules/operations.py +++ b/modules/operations.py @@ -446,7 +446,9 @@ class Operations: logger.separator(f"Deleting All {unmanaged}Collections{print_suffix}", space=False, border=False) logger.info("") unmanaged_collections = [] - for col in self.library.get_all_collections(): + all_collections = self.library.get_all_collections() + for i, col in enumerate(all_collections, 1): + logger.ghost(f"Reading Collection: {i}/{len(all_collections)} {col.title}") labels = [la.tag for la in self.library.item_labels(col)] if (self.library.delete_collections_with_less and col.childCount < self.library.delete_collections_with_less) \ or (self.library.delete_unmanaged_collections and "PMM" not in labels):