[21] better plex_search identification

pull/996/head
meisnate12 2 years ago
parent d613b949d5
commit 62d23897b5

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

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

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

Loading…
Cancel
Save