Class: MpdPlayer
- Inherits:
-
MusicPlayer
- Object
- MusicPlayer
- MpdPlayer
- Defined in:
- lib/sonice-players/mpd.rb
Instance Method Summary collapse
- #current_track ⇒ Object
- #host ⇒ Object
- #launched? ⇒ Boolean
- #next ⇒ Object
- #playpause ⇒ Object
- #prev ⇒ Object
- #voldown ⇒ Object
- #volume ⇒ Object
- #volup ⇒ Object
Instance Method Details
#current_track ⇒ Object
27 28 29 |
# File 'lib/sonice-players/mpd.rb', line 27 def current_track mpc('') end |
#host ⇒ Object
36 37 38 |
# File 'lib/sonice-players/mpd.rb', line 36 def host ENV['MPD_HOST'] || super end |
#launched? ⇒ Boolean
31 32 33 34 |
# File 'lib/sonice-players/mpd.rb', line 31 def launched? %x(mpc 2> /dev/null) $? == 0 end |
#next ⇒ Object
10 11 12 |
# File 'lib/sonice-players/mpd.rb', line 10 def next mpc 'next' end |
#playpause ⇒ Object
2 3 4 |
# File 'lib/sonice-players/mpd.rb', line 2 def playpause mpc 'toggle' end |
#prev ⇒ Object
6 7 8 |
# File 'lib/sonice-players/mpd.rb', line 6 def prev mpc 'prev' end |
#voldown ⇒ Object
14 15 16 |
# File 'lib/sonice-players/mpd.rb', line 14 def voldown mpc 'volume -10' end |
#volume ⇒ Object
22 23 24 25 |
# File 'lib/sonice-players/mpd.rb', line 22 def volume mpc('volume').grep(/([0-9]+)/) $1 end |
#volup ⇒ Object
18 19 20 |
# File 'lib/sonice-players/mpd.rb', line 18 def volup mpc 'volume +10' end |