Class: JimmyJukebox::MusicPlayerDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/jimmy_jukebox/music_player_detector.rb

Instance Method Summary collapse

Instance Method Details

#aac_playerObject



43
44
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 43

def aac_player
end

#afplay_exists?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 102

def afplay_exists?
  `which afplay`.match(/.*\/afplay$/) ? true : false
end

#amarok_exists?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 114

def amarok_exists?
  `which amarok`.match(/.*\/amarok$/) ? true : false
end

#aplay_exists?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 82

def aplay_exists?
  `which aplay`.match(/.*\/aplay$/) ? true : false
end

#cvlc_exists?Boolean

other players possibly worth enabling: 1) xmms2.org/wiki/Using_the_application 2) cmus-remote -p [filename] 3) mpc: can’t figure out how to play just one song

Returns:

  • (Boolean)


78
79
80
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 78

def cvlc_exists?
  `which cvlc`.match(/.*\/cvlc$/) ? true : false
end

#flac_playerObject



63
64
65
66
67
68
69
70
71
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 63

def flac_player
  if cvlc_exists?
    "cvlc --play-and-exit -q"
  elsif play_exists?
    "play"
  elsif mplayer_exists?
    "mplayer -nolirc -noconfig all"
  end
end

#mp3_playerObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 23

def mp3_player
  if mpg123_exists?
    "mpg123"
  elsif mpg321_exists?
    "mpg321"
  elsif music123_exists?
    "music123"
  elsif afplay_exists?
    "afplay"
  elsif mplayer_exists?
    "mplayer -nolirc -noconfig all"
  elsif play_exists?
    "play"
  elsif cvlc_exists?
    "cvlc --play-and-exit -q"
  elsif amarok_exists?
    "amarok"
  end
end

#mpg123_exists?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 90

def mpg123_exists?
  `which mpg123`.match(/.*\/mpg123$/) ? true : false
end

#mpg321_exists?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 98

def mpg321_exists?
  `which mpg321`.match(/.*\/mpg321$/) ? true : false
end

#mplayer_exists?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 106

def mplayer_exists?
  `which mplayer`.match(/.*\/mplayer$/) ? true : false
end

#music123_exists?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 94

def music123_exists?
  `which music123`.match(/.*\/music123$/) ? true : false
end

#ogg123_exists?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 86

def ogg123_exists?
  `which ogg123`.match(/.*\/ogg123$/) ? true : false
end

#ogg_playerObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 5

def ogg_player
  if ogg123_exists?
    "ogg123"
  elsif music123_exists?
    "music123"
  elsif afplay_exists?
    "afplay"
  elsif mplayer_exists?
    "mplayer -nolirc -noconfig all"
  elsif play_exists?
    "play"
  elsif cvlc_exists?
    "cvlc --play-and-exit -q"
  elsif amarok_exists?
    "amarok"
  end
end

#play_exists?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 110

def play_exists?
  `which play`.match(/.*\/play$/) ? true : false
end

#wav_playerObject



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 49

def wav_player
  if cvlc_exists?
    "cvlc --play-and-exit -q"
  elsif play_exists?
    "play"
  elsif mplayer_exists?
    "mplayer -nolirc -noconfig all"
  elsif aplay_exists?
    "aplay"
  elsif amarok_exists?
    "amarok"
  end
end

#wma_playerObject



46
47
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 46

def wma_player
end