[66] fix filter items

pull/1466/head
meisnate12 2 years ago
parent a5585bf346
commit 84c7545873

@ -1 +1 @@
1.19.0-develop65
1.19.0-develop66

@ -1123,7 +1123,7 @@ class CollectionBuilder:
if self.obj and check_url != self.library.smart_filter(self.obj):
self.library.update_smart_collection(self.obj, check_url)
logger.info(f"Detail: Smart Collection updated to {check_url}")
self.beginning_count = len(self.library.get_filter_items(check_url))
self.beginning_count = len(self.library.fetchItems(check_url))
if self.obj:
self.exists = True
if self.sync or self.playlist:
@ -3159,7 +3159,7 @@ class CollectionBuilder:
raise
else:
raise Failed(str(e))
items = self.library.get_filter_items(search_data[2])
items = self.library.fetchItems(search_data[2])
previous = None
sort_edit = False
for i, item in enumerate(items, 0):

@ -496,7 +496,7 @@ class Plex(Library):
args = f"{args}&label={label_id}"
else:
return []
return self.get_filter_items(args)
return self.fetchItems(args)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def search(self, title=None, sort=None, maxresults=None, libtype=None, **kwargs):
@ -527,6 +527,10 @@ class Plex(Library):
def fetchItem(self, data):
return self.PlexServer.fetchItem(data)
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def fetchItems(self, uri_args):
return self.Plex.fetchItems(f"/library/sections/{self.Plex.key}/all{uri_args}")
def get_all(self, builder_level=None, load=False):
if load and builder_level in [None, "show", "artist", "movie"]:
self._all_items = []
@ -865,7 +869,7 @@ class Plex(Library):
def test_smart_filter(self, uri_args):
logger.debug(f"Smart Collection Test: {uri_args}")
test_items = self.get_filter_items(uri_args)
test_items = self.fetchItems(uri_args)
if len(test_items) < 1:
raise Failed(f"Plex Error: No items for smart filter: {uri_args}")
@ -1035,7 +1039,7 @@ class Plex(Library):
elif method == "plex_search":
logger.info(f"Processing {data[1]}")
logger.trace(data[2])
items = self.get_filter_items(data[2])
items = self.fetchItems(data[2])
elif method == "plex_collectionless":
good_collections = []
logger.info(f"Processing Plex Collectionless")
@ -1084,16 +1088,12 @@ class Plex(Library):
return self.search(label=collection.title if isinstance(collection, Collection) else str(collection))
elif isinstance(collection, (Collection, Playlist)):
if collection.smart:
return self.get_filter_items(self.smart_filter(collection))
return self.fetchItems(self.smart_filter(collection))
else:
return self.query(collection.items)
else:
return []
def get_filter_items(self, uri_args):
key = f"/library/sections/{self.Plex.key}/all{uri_args}"
return self.Plex._search(key, None, 0, plexapi.X_PLEX_CONTAINER_SIZE)
def get_collection_name_and_items(self, collection, smart_label_collection):
name = collection.title if isinstance(collection, (Collection, Playlist)) else str(collection)
return name, self.get_collection_items(collection, smart_label_collection)

Loading…
Cancel
Save