Skip to content
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

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

Merged
merged 3 commits into from Mar 16, 2024

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Feb 26, 2024

Description

Fixes #1375

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

@glensc
Copy link
Contributor Author

glensc commented Feb 26, 2024

actually, i'm not sure what was happening. as the "items" doesn't seem to be passed to the _createSmart method

@glensc
Copy link
Contributor Author

glensc commented Feb 26, 2024

so, what was happening was that it called this URL:

  • /playlists?smart=1&title=The Melchior Collection&type=video&uri=server://[redacted]/com.plexapp.plugins.library/library/sections/1/all?includeGuids=1&type=1

which seems like smart playlist with no filters (so it contains whole library)

@glensc
Copy link
Contributor Author

glensc commented Feb 27, 2024

Maybe what could be done here instead is to raise an error if no filters are provided

@JonnyWong16
Copy link
Collaborator

I would expect a smart playlist to contain the entire library if no filters are provided. I don't think we should restrict that.

@glensc
Copy link
Contributor Author

glensc commented Feb 29, 2024

So the change here should be fine. It would disallow using smart and items, possibly not confusing the user.

user can still create smart playlist without filters as long as they don't also pass items.

Copy link
Collaborator

@JonnyWong16 JonnyWong16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add the same exception for smart collections?

if smart:
return cls._createSmart(server, title, section, limit, libtype, sort, filters, **kwargs)

plexapi/playlist.py Outdated Show resolved Hide resolved
@JonnyWong16 JonnyWong16 changed the title Fix: Disallow using smart playlist with items Fix: Raise an exception when trying to create a smart collection/playlist with items Mar 1, 2024
glensc and others added 2 commits March 1, 2024 10:39
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
@glensc glensc requested a review from JonnyWong16 March 1, 2024 08:41
@JonnyWong16 JonnyWong16 merged commit b494e8e into pkkid:master Mar 16, 2024
5 checks passed
@glensc glensc deleted the 1375-pl-smart branch March 17, 2024 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createPlaylist does not guard smart=True and non-empty items
2 participants