mirror of
https://github.com/pkkid/python-plexapi
synced 2025-02-16 12:58:26 +00:00
Add method to get a collection or playlist by title in a library
This commit is contained in:
parent
0512e9f38e
commit
2cd29f435a
1 changed files with 19 additions and 3 deletions
|
@ -1371,9 +1371,15 @@ class LibrarySection(PlexObject):
|
|||
title, section=self, items=items, smart=smart, limit=limit,
|
||||
libtype=libtype, sort=sort, filters=filters, **kwargs)
|
||||
|
||||
@deprecated('use "collections" (plural) instead')
|
||||
def collection(self, **kwargs):
|
||||
return self.collections()
|
||||
def collection(self, title):
|
||||
""" Returns the collection with the specified title.
|
||||
|
||||
Parameters:
|
||||
title (str): Title of the item to return.
|
||||
"""
|
||||
results = self.collections(title__iexact=title)
|
||||
if results:
|
||||
return results[0]
|
||||
|
||||
def collections(self, **kwargs):
|
||||
""" Returns a list of collections from this library section.
|
||||
|
@ -1390,6 +1396,16 @@ class LibrarySection(PlexObject):
|
|||
title, section=self, items=items, smart=smart, limit=limit,
|
||||
sort=sort, filters=filters, **kwargs)
|
||||
|
||||
def playlist(self, title):
|
||||
""" Returns the playlist with the specified title.
|
||||
|
||||
Parameters:
|
||||
title (str): Title of the item to return.
|
||||
"""
|
||||
results = self.playlists(title__iexact=title)
|
||||
if results:
|
||||
return results[0]
|
||||
|
||||
def playlists(self, **kwargs):
|
||||
""" Returns a list of playlists from this library section. """
|
||||
key = '/playlists?type=15&playlistType=%s§ionID=%s' % (self.CONTENT_TYPE, self.key)
|
||||
|
|
Loading…
Add table
Reference in a new issue