From d1172f49756a8a9beeb70aac22fa6d61a2aacafc Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 1 Oct 2020 14:40:12 -0700 Subject: [PATCH] Add playlist method to plexapi.library.LibrarySection --- lib/plexapi/library.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/plexapi/library.py b/lib/plexapi/library.py index 51ef1ecc..8f18abec 100644 --- a/lib/plexapi/library.py +++ b/lib/plexapi/library.py @@ -769,6 +769,11 @@ class MovieSection(LibrarySection): """ Returns a list of collections from this library section. """ return self.search(libtype='collection', **kwargs) + def playlist(self, **kwargs): + """ Returns a list of playlists from this library section. """ + key = '/playlists?type=15&playlistType=%s§ionID=%s' % (self.CONTENT_TYPE, self.key) + return self.fetchItems(key) + def sync(self, videoQuality, limit=None, unwatched=False, **kwargs): """ Add current Movie library section as sync item for specified device. See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and @@ -849,6 +854,11 @@ class ShowSection(LibrarySection): """ Returns a list of collections from this library section. """ return self.search(libtype='collection', **kwargs) + def playlist(self, **kwargs): + """ Returns a list of playlists from this library section. """ + key = '/playlists?type=15&playlistType=%s§ionID=%s' % (self.CONTENT_TYPE, self.key) + return self.fetchItems(key) + def sync(self, videoQuality, limit=None, unwatched=False, **kwargs): """ Add current Show library section as sync item for specified device. See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and @@ -930,6 +940,11 @@ class MusicSection(LibrarySection): """ Returns a list of collections from this library section. """ return self.search(libtype='collection', **kwargs) + def playlist(self, **kwargs): + """ Returns a list of playlists from this library section. """ + key = '/playlists?type=15&playlistType=%s§ionID=%s' % (self.CONTENT_TYPE, self.key) + return self.fetchItems(key) + def sync(self, bitrate, limit=None, **kwargs): """ Add current Music library section as sync item for specified device. See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and @@ -991,6 +1006,11 @@ class PhotoSection(LibrarySection): """ Search for a photo. See :func:`~plexapi.library.LibrarySection.search()` for usage. """ return self.search(libtype='photo', title=title, **kwargs) + def playlist(self, **kwargs): + """ Returns a list of playlists from this library section. """ + key = '/playlists?type=15&playlistType=%s§ionID=%s' % (self.CONTENT_TYPE, self.key) + return self.fetchItems(key) + def sync(self, resolution, limit=None, **kwargs): """ Add current Music library section as sync item for specified device. See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and