Class: MPD::Commands::PlaylistAdd

Inherits:
Abstract
  • Object
show all
Defined in:
lib/mpd/commands/playlist_add.rb

Overview

Adds song(s) to specific playlist.

Instance Attribute Summary

Attributes inherited from Abstract

#connection

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from MPD::Commands::Abstract

Instance Method Details

#execute(name, songs) ⇒ Object

Parameters:

  • name (String)

    playlist name.

  • songs (Array<String>, String)

    file URIs.


13
14
15
16
# File 'lib/mpd/commands/playlist_add.rb', line 13

def execute(name, songs)
  return exec_command("playlistadd \"#{name}\" \"#{songs}\"") unless songs.is_a?(Array)
  exec_command_list(songs.map { |s| "playlistadd \"#{name}\" \"#{s}\"" })
end