From a3399c86fe3f55a269f288ad13da5b248b5de7f9 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 22 Jul 2009 08:09:03 -0700 Subject: Add methods for volume and playback options. --- libmpd.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/libmpd.rb b/libmpd.rb index b35801a..e6a6584 100644 --- a/libmpd.rb +++ b/libmpd.rb @@ -142,6 +142,38 @@ 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 + end + + # Sets crossfading between songs. + def crossfade seconds + return send_request 'crossfade ' + seconds.to_s + end + + # Sets random state. + def random state + return send_request 'random ' + state.to_s + end + + # Sets repeat state. + def repeat state + return send_request 'repeat ' + state.to_s + end + + # Sets volume from a range of 0-100. + def setvol volume + 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 + end + private :generate_hash private :get_response private :split_and_hash -- cgit v1.2.3-70-g09d2