Class: MpdPlayer

Inherits:
MusicPlayer
  • Object
show all
Defined in:
lib/sonice-players/mpd.rb

Instance Method Summary collapse

Instance Method Details

#current_trackObject



27
28
29
# File 'lib/sonice-players/mpd.rb', line 27

def current_track
  mpc('')
end

#hostObject



36
37
38
# File 'lib/sonice-players/mpd.rb', line 36

def host
  ENV['MPD_HOST'] || super
end

#launched?Boolean

Returns:

  • (Boolean)


31
32
33
34
# File 'lib/sonice-players/mpd.rb', line 31

def launched?
  %x(mpc 2> /dev/null)
  $? == 0
end

#nextObject



10
11
12
# File 'lib/sonice-players/mpd.rb', line 10

def next
  mpc 'next'
end

#playpauseObject



2
3
4
# File 'lib/sonice-players/mpd.rb', line 2

def playpause
  mpc 'toggle'
end

#prevObject



6
7
8
# File 'lib/sonice-players/mpd.rb', line 6

def prev
  mpc 'prev'
end

#voldownObject



14
15
16
# File 'lib/sonice-players/mpd.rb', line 14

def voldown
  mpc 'volume -10'
end

#volumeObject



22
23
24
25
# File 'lib/sonice-players/mpd.rb', line 22

def volume
  mpc('volume').grep(/([0-9]+)/)
  $1
end

#volupObject



18
19
20
# File 'lib/sonice-players/mpd.rb', line 18

def volup
  mpc 'volume +10'
end