From 7a5adb16225e564e06618539a24c0da818adf2c2 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 22 Jul 2009 08:21:08 -0700 Subject: Add playid and seekid methods. --- libmpd.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libmpd.rb b/libmpd.rb index e6a6584..d211e71 100644 --- a/libmpd.rb +++ b/libmpd.rb @@ -68,7 +68,7 @@ class MPD end # Begins playing the playlist. If argument is supplied, begin at specified - # position. + # song position. def play songpos=false command = 'play' command << ' ' + songpos.to_s if songpos @@ -76,6 +76,15 @@ class MPD return send_request command end + # Begins playing the playlist. If argument is supplied, begin at specified + # song id. + def playid songid=false + command = 'playid' + command << ' ' + songid.to_s if songid + + return send_request command + end + # Toggles pause. (1 = pause, 0 = play) def pause pause return send_request 'pause ' + pause.to_s @@ -101,6 +110,11 @@ class MPD return send_request 'seek %s %s' % [songpos, time] end + # Seeks to the given position of the given song id. + def seekid songid, time + return send_request 'seekid %s %s' % [songid, time] + end + # Adds the specified file to the playlist. (Directories add recursively.) def add uri return send_request 'add "%s"' % uri -- cgit v1.2.3-70-g09d2