module MPD::Plugins::Controls
Commands for controlling playback.
Public Instance Methods
next()
click to toggle source
Plays the next song in the playlist. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 7 def next send_command :next end
pause=(toggle)
click to toggle source
Resume/pause playback. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 13 def pause=(toggle) send_command :pause, toggle end
play(pos = nil)
click to toggle source
Begin/resume playing the queue. @param [Integer] pos Position in the playlist to start playing. @param [Hash] pos :id of the song where to start playing. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 21 def play(pos = nil) if pos.is_a?(Hash) if pos[:id] send_command :playid, pos[:id] else raise ArgumentError, 'Only :id key is allowed!' end else send_command :play, pos end end
previous()
click to toggle source
Plays the previous song in the playlist. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 35 def previous send_command :previous end
seek(time, options = {})
click to toggle source
Seeks to the position in seconds within the current song. If prefixed by ‘+’ or ‘-’, then the time is relative to the current playing position.
@since MPD
0.17 @param [Integer, String] time Position within the current song. @param [Hash] options Either :id
or :pos
can be specified. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 47 def seek(time, options = {}) if options[:id] send_command :seekid, options[:id], time elsif options[:pos] send_command :seek, options[:pos], time else send_command :seekcur, time end end
stop()
click to toggle source
Stop playing. @macro returnraise
# File lib/ruby-mpd/plugins/controls.rb, line 59 def stop send_command :stop end