summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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?