Skip to content

Playlist.addItems throws on empty list #566

@jasmith79

Description

@jasmith79

Describe the issue
Creating an empty playlist throws an IndexError.

Code snippets

# The relevant code from plexapi.playlist addItems method:
# line 95
uuid = items[0].section().uuid # IndexError thrown here, there is no check for empty list.

Expected behavior
The method should either be a no-op or throw a more meaningful error (e.g. asserting the input is a non-empty List/Tuple).

Enviroment (please complete the following information):

  • OS: MacOS Catalina
  • Plex version 1.20.1.3252
  • Python Version 3.8
  • PlexAPI version 4.1.0

Stumbled across this when someone opened an issue about it on my iTunes playlist importer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions