[24] #997 use ignore_blank_results to create blank smart collections

This commit is contained in:
meisnate12 2022-08-09 01:49:02 -04:00
parent 50d7fe0bf7
commit b5d6067985
3 changed files with 6 additions and 5 deletions

View file

@ -1 +1 @@
1.17.2-develop23
1.17.2-develop24

View file

@ -2419,7 +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)
self.library.create_smart_collection(self.name, self.smart_type_key, self.smart_url, self.ignore_blank_results)
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)
@ -2429,7 +2429,7 @@ class CollectionBuilder:
raise Failed
smart_type, _, self.smart_url = self.build_filter("smart_label", self.smart_label, default_sort="random")
if not self.obj:
self.library.create_smart_collection(self.name, smart_type, self.smart_url)
self.library.create_smart_collection(self.name, smart_type, self.smart_url, self.ignore_blank_results)
except Failed:
raise Failed(f"{self.Type} Error: Label: {self.name} was not added to any items in the Library")
self.obj = self.library.get_playlist(self.name) if self.playlist else self.library.get_collection(self.name)

View file

@ -713,8 +713,9 @@ class Plex(Library):
if len(test_items) < 1:
raise Failed(f"Plex Error: No items for smart filter: {uri_args}")
def create_smart_collection(self, title, smart_type, uri_args):
self.test_smart_filter(uri_args)
def create_smart_collection(self, title, smart_type, uri_args, ignore_blank_results):
if not ignore_blank_results:
self.test_smart_filter(uri_args)
args = {
"type": smart_type,
"title": title,