Skip to content

Fix: Raise an exception when trying to create a smart collection/playlist with items #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plexapi/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ def create(cls, server, title, section, items=None, smart=False, limit=None,
: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)
Expand Down
2 changes: 2 additions & 0 deletions plexapi/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ def create(cls, server, title, section=None, items=None, smart=False, limit=None
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)
Expand Down