diff options
Diffstat (limited to 'libmpd')
| -rw-r--r-- | libmpd/playlist.rb | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/libmpd/playlist.rb b/libmpd/playlist.rb index 000f9c9..2b40ce4 100644 --- a/libmpd/playlist.rb +++ b/libmpd/playlist.rb @@ -17,6 +17,15 @@ module MPDPlaylist      return send_request('add "%s"' % uri)    end +  # Adds the specified file to the playlist and returns the song id. +  # An optional playlist position can be specified. +  def addid(uri, position=nil) +    command = 'addid "%s"' % uri +    command << ' %s' % position if position + +    return send_request(command).scan(/(?!Id: )\d+/).first.to_i +  end +    # Deletes a song from the playlist.    def delete(songpos)      return send_request('delete %s' % songpos) | 
