Skip to content

Add ability to retrieve playlist items by libtype#1604

Open
JonnyWong16 wants to merge 2 commits intopushingkarmaorg:masterfrom
JonnyWong16:feature/playlist_libtype
Open

Add ability to retrieve playlist items by libtype#1604
JonnyWong16 wants to merge 2 commits intopushingkarmaorg:masterfrom
JonnyWong16:feature/playlist_libtype

Conversation

@JonnyWong16
Copy link
Copy Markdown
Collaborator

Description

Add ability to retrieve playlist items by libtype.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • 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

Copilot AI review requested due to automatic review settings April 7, 2026 07:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for filtering playlist items by library type (libtype) when retrieving items from a playlist.

Changes:

  • Extend Playlist.items() to accept an optional libtype filter and pass type=<searchType> to the /playlists/<id>/items query.
  • Refactor item-fetching logic into a helper and keep the unfiltered result cached via @cached_data_property.
  • Add a new test validating items(libtype=...) behavior for show/season/episode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plexapi/playlist.py Adds optional libtype filtering when fetching playlist items (via type query param) while preserving cached unfiltered results.
tests/test_playlist.py Renames the playlist items test and adds coverage for retrieving playlist items filtered by libtype.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +134 to +135
finally:
playlist.delete()
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

playlist.delete() in the finally block can raise UnboundLocalError if plex.createPlaylist(...) fails before playlist is assigned. Initialize playlist = None before the try and guard the delete (e.g., if playlist: playlist.delete()).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants