-
Notifications
You must be signed in to change notification settings - Fork 200
Description
Describe the issue
The current library search loop breaks when no results are found.
https://github.com/pkkid/python-plexapi/blob/4.4.1/plexapi/library.py#L691
If a PlexAPI operator is used (e.g. viewCount__gt=0
), the first batch of results may return 0 results (i.e. There are no items with a view count greater than 1 in the first 100 items (container_size
)). This causes the loop to break without continuing the search through the rest of the items.
Code snipppets
>>> library = plex.library.section("TV Shows")
>>> results = library.search(libtype='episode', container_size=1, viewCount__gte=0)
>>> print(len(results))
0
Expected behavior
Search should continue looping through the rest of the items.
Proposed solution is to add a check if the container exceeds the total number of items to exit the loop.
https://github.com/pkkid/python-plexapi/blob/4.4.1/plexapi/library.py#L707
if container_start > self.totalSize:
break
Enviroment (please complete the following information):
- PlexAPI version: 4.4.1