summaryrefslogtreecommitdiff
path: root/libmpd/playbackoptions.rb
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-24 13:50:46 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2009-07-24 13:50:46 -0700
commit6a26bf725101f938a0d1526176f57bdff0fc9293 (patch)
treec33a3d5872a180ef80238220128540145f0b5047 /libmpd/playbackoptions.rb
parentae4ebcb66d4d0c39ac4a29c520ea3bab22b15023 (diff)
downloadruby-libmpd-6a26bf725101f938a0d1526176f57bdff0fc9293.tar.gz
ruby-libmpd-6a26bf725101f938a0d1526176f57bdff0fc9293.tar.xz
Reorganise PlaybackOptions and improve docs.
Diffstat (limited to 'libmpd/playbackoptions.rb')
-rw-r--r--libmpd/playbackoptions.rb70
1 files changed, 35 insertions, 35 deletions
diff --git a/libmpd/playbackoptions.rb b/libmpd/playbackoptions.rb
index 3e6ad1e..9b82157 100644
--- a/libmpd/playbackoptions.rb
+++ b/libmpd/playbackoptions.rb
@@ -14,34 +14,60 @@ module MPDPlaybackOptions
# 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_.
+ # 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
+ # Returns +true+ if consume is activated.
+ # Otherwise, returns +false+.
+ def consume?
+ return true if status[:consume] == '1'
+ return false
+ end
+
# Sets crossfading between songs.
def crossfade seconds
return send_request 'crossfade ' + seconds.to_s
end
+ # Returns the current crossfade setting as an integer.
+ def crossfade?
+ return status[:xfade].to_i
+ end
+
# Sets random state.
#
- # Accepts an argument of _true_ to enable or _false_ to disable.
- # If no argument is given, defaults to _true_.
+ # 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
+ # Returns +true+ if random is activated.
+ # Otherwise, returns +false+.
+ def random?
+ return true if status[:random] == '1'
+ return false
+ end
+
# Sets repeat state.
#
- # Accepts an argument of _true_ to enable or _false_ to disable.
- # If no argument is given, defaults to _true_.
+ # 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.
+ # Returns +true+ if repeat is activated.
+ # Otherwise, returns +false+.
+ def repeat?
+ return true if status[:repeat] == '1'
+ return false
+ end
+
+ # Sets volume from a range of 0 to 100.
def volume volume
return send_request 'setvol ' + volume.to_s
end
@@ -51,42 +77,16 @@ module MPDPlaybackOptions
return status[:volume].to_i
end
- # Returns the current crossfade setting as an integer.
- def crossfade?
- return status[:xfade].to_i
- end
-
# 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_.
+ # 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
- # Returns +true+ if consume is activated.
- # Otherwise, returns +false+.
- def consume?
- return true if status[:consume] == '1'
- return false
- end
-
- # Returns +true+ if random is activated.
- # Otherwise, returns +false+.
- def random?
- return true if status[:random] == '1'
- return false
- end
-
- # Returns +true+ if repeat is activated.
- # Otherwise, returns +false+.
- def repeat?
- return true if status[:repeat] == '1'
- return false
- end
-
# Returns +true+ if single is activated.
# Otherwise, returns +false+.
def single?