Skip to content

Instantiate a playlist by name #52

@Phrogz

Description

@Phrogz

My UI uses the name of a playlist as the unique identifier. When I want to fetch a playlist with this name I must currently use one of the following:

playlist = @mpd.playlists.find{ |pl| pl.name==playlistname }
playlist = MPD::Playlist.new( @mpd, playlist:playlistname )

Using find feels gross because it instantiates all the playlists (maybe a great many) when I only need one. Using new feels gross because if I mistakenly ask for a playlist that does not exist it will be created.

I'd prefer to be able to do something like:

playlist = @mpd.playlist( playlistname )

Does that seem reasonable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions