Class: Anyplayer::Xmms2

Inherits:
Player
  • Object
show all
Defined in:
lib/anyplayer/players/xmms2.rb

Constant Summary

Constants inherited from Player

Player::DEFAULT_VOTES_TO_SKIP

Instance Method Summary collapse

Methods inherited from Player

#initialize, #name, #vote, #votes

Constructor Details

This class inherits a constructor from Anyplayer::Player

Instance Method Details

#albumObject



45
46
47
# File 'lib/anyplayer/players/xmms2.rb', line 45

def album
  xmms2 "current -f '${album}'"
end

#artistObject



41
42
43
# File 'lib/anyplayer/players/xmms2.rb', line 41

def artist
  xmms2 "current -f '${artist}'"
end

#hostObject



63
64
65
# File 'lib/anyplayer/players/xmms2.rb', line 63

def host
  ENV["XMMS_PATH"] || super
end

#launched?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
# File 'lib/anyplayer/players/xmms2.rb', line 57

def launched?
  # xmms2 autolaunches the daemon, so this should always be true
  %x(xmms2 current 2> /dev/null)
  $? == 0
end

#nextObject



19
20
21
22
# File 'lib/anyplayer/players/xmms2.rb', line 19

def next
  xmms2 "next"
  super
end

#pauseObject



10
11
12
# File 'lib/anyplayer/players/xmms2.rb', line 10

def pause
  xmms2 "pause"
end

#paused?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/anyplayer/players/xmms2.rb', line 53

def paused?
  xmms2("current -f '${playback_status}'") == "Paused"
end

#platformsObject



67
68
69
# File 'lib/anyplayer/players/xmms2.rb', line 67

def platforms
  [:unix, :linux]
end

#playObject



6
7
8
# File 'lib/anyplayer/players/xmms2.rb', line 6

def play
  xmms2 "play"
end

#playing?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/anyplayer/players/xmms2.rb', line 49

def playing?
  xmms2("current -f '${playback_status}'") == "Playing"
end

#playpauseObject



2
3
4
# File 'lib/anyplayer/players/xmms2.rb', line 2

def playpause
  xmms2 "toggle"
end

#prevObject



14
15
16
17
# File 'lib/anyplayer/players/xmms2.rb', line 14

def prev
  xmms2 "prev"
  super
end

#trackObject



37
38
39
# File 'lib/anyplayer/players/xmms2.rb', line 37

def track
  xmms2 "current -f '${title}'"
end

#voldownObject



24
25
26
# File 'lib/anyplayer/players/xmms2.rb', line 24

def voldown
  set_volume volume - 10
end

#volumeObject



32
33
34
35
# File 'lib/anyplayer/players/xmms2.rb', line 32

def volume
  # currently just the first (left?) channel
  xmms2("server volume").split("\n").first.sub(/([^0-9]*)/, "").to_i
end

#volupObject



28
29
30
# File 'lib/anyplayer/players/xmms2.rb', line 28

def volup
  set_volume volume + 10
end