-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using maxresults
in fetchItems() tramples over results
#1393
Comments
6 tasks
Touchstone64
pushed a commit
to Touchstone64/python-plexapi
that referenced
this issue
Apr 9, 2024
Touchstone64
pushed a commit
to Touchstone64/python-plexapi
that referenced
this issue
Apr 9, 2024
Touchstone64
pushed a commit
to Touchstone64/python-plexapi
that referenced
this issue
Apr 9, 2024
JonnyWong16
added a commit
that referenced
this issue
Apr 19, 2024
* Fix: stop maxresults from overwriting previous results * Added test for use of maxresults in fetchItems #1393 * Removed the need for last_container_size #1393 * Renamed collections to better represen what is being tested * Renamed collections to better represent what is being tested #1393 * Update tests/test_library.py with cleaner test Co-authored-by: JonnyWong16 <[email protected]> --------- Co-authored-by: Graham Thompson <[email protected]> Co-authored-by: JonnyWong16 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the Bug
plexapi.server.library.fetchItems()
supports amaxresults
parameter which, when specified, limits the number of results returned. In code, this is implemented by reducing the size of the container used when there are fewer thancontainer_size
results that need to be fetched.If
maxresults
were set to 123, for example, then the first fetch would get 100 items (because of the default container size), and the second only 23. In this example, on the second fetch the container size would be reduced to 23.At the end of the
fetchItems
loop,container_start
is advanced bycontainer_size
ready to receive the next batch of results. Unfortunately this is done aftercontainer_size
is modified to supportmaxresults
. So, in the example above,container_start
is set to 23, so the next batch of results overwrites whatever results were already 'at 23' in the container.Code Snippets
Expected Behavior
fetchItems()
in PlexObject would return the media requested whethermaxresults
is specified or not.Additional Context
No response
Operating System and Version
macOS 14.3.1
Plex Media Server Version
4.125.1
Python Version
3.12.2
PlexAPI Version
4.15.11
The text was updated successfully, but these errors were encountered: