mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 13:40:22 +00:00
Merge pull request #535 from nwithan8/patch-2
Playlist creation - check items are included, raise exception
This commit is contained in:
commit
ed0532c040
1 changed files with 6 additions and 0 deletions
|
@ -167,6 +167,9 @@ class Playlist(PlexPartialObject, Playable):
|
|||
@classmethod
|
||||
def _create(cls, server, title, items):
|
||||
""" Create a playlist. """
|
||||
if not items:
|
||||
raise BadRequest('Must include items to add when creating new playlist')
|
||||
|
||||
if items and not isinstance(items, (list, tuple)):
|
||||
items = [items]
|
||||
ratingKeys = []
|
||||
|
@ -198,6 +201,9 @@ class Playlist(PlexPartialObject, Playable):
|
|||
smart (bool): default False.
|
||||
|
||||
**kwargs (dict): is passed to the filters. For a example see the search method.
|
||||
|
||||
Raises:
|
||||
:class:`plexapi.exceptions.BadRequest`: when no items are included in create request.
|
||||
|
||||
Returns:
|
||||
:class:`~plexapi.playlist.Playlist`: an instance of created Playlist.
|
||||
|
|
Loading…
Reference in a new issue