@@ -565,6 +565,10 @@ class MovieSection(LibrarySection):
565565 TAG = 'Directory'
566566 TYPE = 'movie'
567567
568+ def collection (self , ** kwargs ):
569+ """ Returns a list of collections from this library section. """
570+ return self .search (libtype = 'collection' , ** kwargs )
571+
568572
569573class ShowSection (LibrarySection ):
570574 """ Represents a :class:`~plexapi.library.LibrarySection` section containing tv shows.
@@ -600,6 +604,10 @@ def recentlyAdded(self, libtype='episode', maxresults=50):
600604 """
601605 return self .search (sort = 'addedAt:desc' , libtype = libtype , maxresults = maxresults )
602606
607+ def collection (self , ** kwargs ):
608+ """ Returns a list of collections from this library section. """
609+ return self .search (libtype = 'collection' , ** kwargs )
610+
603611
604612class MusicSection (LibrarySection ):
605613 """ Represents a :class:`~plexapi.library.LibrarySection` section containing music artists.
@@ -634,6 +642,10 @@ def searchTracks(self, **kwargs):
634642 """ Search for a track. See :func:`~plexapi.library.LibrarySection.search()` for usage. """
635643 return self .search (libtype = 'track' , ** kwargs )
636644
645+ def collection (self , ** kwargs ):
646+ """ Returns a list of collections from this library section. """
647+ return self .search (libtype = 'collection' , ** kwargs )
648+
637649
638650class PhotoSection (LibrarySection ):
639651 """ Represents a :class:`~plexapi.library.LibrarySection` section containing photos.
@@ -714,3 +726,25 @@ def _loadData(self, data):
714726
715727 def __len__ (self ):
716728 return self .size
729+
730+ @utils .registerPlexObject
731+ class Collections (PlexObject ):
732+
733+ TAG = 'Directory'
734+ TYPE = 'collection'
735+
736+ def _loadData (self , data ):
737+ self .ratingKey = data .attrib .get ('ratingKey' )
738+ self .key = data .attrib .get ('key' )
739+ self .type = data .attrib .get ('type' )
740+ self .title = data .attrib .get ('title' )
741+ self .subtype = data .attrib .get ('subtype' )
742+ self .summary = data .attrib .get ('summary' )
743+ self .index = data .attrib .get ('index' )
744+ self .thumb = data .attrib .get ('thumb' )
745+ self .addedAt = data .attrib .get ('addedAt' )
746+ self .updatedAt = data .attrib .get ('updatedAt' )
747+ self .childCount = data .attrib .get ('childCount' )
748+ self .maxYear = data .attrib .get ('maxYear' )
749+ self .children = self .fetchItems (self .key )
750+
0 commit comments