Update LibrarySection.all() method

* Uses LibrarySection.search() for more filter/sorting options and faster paging of results
This commit is contained in:
JonnyWong16 2020-12-23 15:45:21 -08:00
parent 5200a95e79
commit 1d0527bd7e
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -437,18 +437,15 @@ class LibrarySection(PlexObject):
key = '/library/sections/%s/all?title=%s' % (self.key, quote(title, safe=''))
return self.fetchItem(key, title__iexact=title)
def all(self, sort=None, **kwargs):
""" Returns a list of media from this library section.
Parameters:
sort (string): The sort string
def all(self, libtype=None, **kwargs):
""" Returns a list of all items from this library section.
See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting.
"""
sortStr = ''
if sort is not None:
sortStr = '?sort=' + sort
key = '/library/sections/%s/all%s' % (self.key, sortStr)
return self.fetchItems(key, **kwargs)
if isinstance(self, PhotoSection):
libtype = 'photoalbum'
elif libtype is None:
libtype = self.TYPE
return self.search(libtype=libtype, **kwargs)
def folders(self):
""" Returns a list of available :class:`~plexapi.library.Folder` for this library section.