summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-23 19:11:08 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-23 19:11:08 -0700
commitee7ac5936fd8c103cb32759df748df09990ee288 (patch)
treec4fdb270c7a82c737cee73c912858ba47b9ff70c
parent7cfd4f7e7621a93dc92f468e99450e257bbeaa2c (diff)
downloadruby-libmpd-ee7ac5936fd8c103cb32759df748df09990ee288.tar.gz
ruby-libmpd-ee7ac5936fd8c103cb32759df748df09990ee288.tar.xz
Update consume, random, repeat and single methods.
-rw-r--r--libmpd.rb37
1 files changed, 25 insertions, 12 deletions
diff --git a/libmpd.rb b/libmpd.rb
index 80a75ef..0d2b41e 100644
--- a/libmpd.rb
+++ b/libmpd.rb
@@ -171,10 +171,13 @@ class MPD
return split_and_hash send_request 'search %s "%s"' % [type, what]
end
- # Sets consume state. When consume is activated, each song played is
- # removed from playlist.
- def consume state
- return send_request 'consume ' + state.to_s
+ # Sets consume state.
+ # When consume is activated, each song played is removed from the playlist.
+ #
+ # Accepts an argument of _true_ to enable or _false_ to disable.
+ # If no argument is given, defaults to _true_.
+ def consume state=true
+ return send_request 'consume %s' % state.to_i
end
# Sets crossfading between songs.
@@ -183,13 +186,19 @@ class MPD
end
# Sets random state.
- def random state
- return send_request 'random ' + state.to_s
+ #
+ # Accepts an argument of _true_ to enable or _false_ to disable.
+ # If no argument is given, defaults to _true_.
+ def random state=true
+ return send_request 'random %s' % state.to_i
end
# Sets repeat state.
- def repeat state
- return send_request 'repeat ' + state.to_s
+ #
+ # Accepts an argument of _true_ to enable or _false_ to disable.
+ # If no argument is given, defaults to _true_.
+ def repeat state=true
+ return send_request 'repeat %s' % state.to_i
end
# Sets volume from a range of 0-100.
@@ -197,10 +206,14 @@ class MPD
return send_request 'setvol ' + volume.to_s
end
- # Sets single state. When single is activated, playback is stopped after
- # current song, or song is repeated if the 'repeat' mode is enabled.
- def single state
- return send_request 'single ' + state.to_s
+ # Sets single state.
+ # When single is activated, playback is stopped after the current song. If
+ # repeat is also activated, the current song is repeated.
+ #
+ # Accepts an argument of _true_ to enable or _false_ to disable.
+ # If no argument is given, defaults to _true_.
+ def single state=true
+ return send_request 'single %s' % state.to_i
end
private :generate_hash