[21] better plex_search identification

This commit is contained in:
meisnate12 2022-08-04 16:47:54 -04:00
parent d613b949d5
commit 62d23897b5
3 changed files with 12 additions and 11 deletions

View file

@ -1 +1 @@
1.17.2-develop20
1.17.2-develop21

View file

@ -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:

View file

@ -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):