mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Fix: Raise an exception when trying to create a smart collection/playlist with items (#1377)
* Disallow using smart playlist with items * Change exception message Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> * Also check for state when creating collections --------- Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
parent
97faf3ccce
commit
b494e8e2f1
2 changed files with 4 additions and 0 deletions
|
@ -503,6 +503,8 @@ class Collection(
|
|||
:class:`~plexapi.collection.Collection`: A new instance of the created Collection.
|
||||
"""
|
||||
if smart:
|
||||
if items:
|
||||
raise BadRequest('Cannot create a smart collection with items.')
|
||||
return cls._createSmart(server, title, section, limit, libtype, sort, filters, **kwargs)
|
||||
else:
|
||||
return cls._create(server, title, section, items)
|
||||
|
|
|
@ -434,6 +434,8 @@ class Playlist(
|
|||
if m3ufilepath:
|
||||
return cls._createFromM3U(server, title, section, m3ufilepath)
|
||||
elif smart:
|
||||
if items:
|
||||
raise BadRequest('Cannot create a smart playlist with items.')
|
||||
return cls._createSmart(server, title, section, limit, libtype, sort, filters, **kwargs)
|
||||
else:
|
||||
return cls._create(server, title, items)
|
||||
|
|
Loading…
Reference in a new issue