Skip to content

Commit

Permalink
Use totalSize attribute for watchlist walking (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Dec 21, 2022
1 parent b056e9d commit c3d2a56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plexapi/myplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,11 @@ def watchlist(self, filter=None, sort=None, libtype=None, maxresults=9999999, **
results += subresults[:maxresults - len(results)]
params['X-Plex-Container-Start'] += params['X-Plex-Container-Size']

# totalSize is available in first response, update maxresults from it
totalSize = utils.cast(int, data.attrib.get('totalSize'))
if maxresults > totalSize:
maxresults = totalSize

return self._toOnlineMetadata(results)

def onWatchlist(self, item):
Expand Down

0 comments on commit c3d2a56

Please sign in to comment.