class Anyplayer::Mpd
Public Class Methods
new()
click to toggle source
Calls superclass method
Anyplayer::Player::new
# File lib/anyplayer/players/mpd.rb, line 9 def initialize @mpc = false super end
Public Instance Methods
album()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 63 def album current_song&.album end
artist()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 59 def artist current_song&.artist end
host()
click to toggle source
Calls superclass method
# File lib/anyplayer/players/mpd.rb, line 71 def host ENV["MPD_HOST"] || super end
launched?()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 67 def launched? !!(@mpc && @mpc.connected? || connect) end
next()
click to toggle source
Calls superclass method
Anyplayer::Player#next
# File lib/anyplayer/players/mpd.rb, line 35 def next mpc.next super end
pause()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 24 def pause # ruby-mpd tries to send an additional argument to the MPD server # which at least doesn't work with Mopidy. mpc.send_command :pause end
play()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 20 def play mpc.play end
playpause()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 14 def playpause mpc.paused? && mpc.send_command(:play) || mpc.send_command(:pause) end
prev()
click to toggle source
Calls superclass method
Anyplayer::Player#prev
# File lib/anyplayer/players/mpd.rb, line 30 def prev mpc.previous super end
track()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 52 def track song = current_song return unless song song.title || File.basename(song.file) end
voldown()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 40 def voldown mpc.volume -= 10 end
volume()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 48 def volume mpc.volume end
volup()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 44 def volup mpc.volume += 10 end
Private Instance Methods
connect()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 81 def connect @mpc ||= MPD.new @mpc.connect rescue false end
current_song()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 77 def current_song mpc.current_song end
mpc()
click to toggle source
# File lib/anyplayer/players/mpd.rb, line 88 def mpc @mpc || connect @mpc end