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



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

def aac_player
end

#afplay_exists?Boolean

Returns:

  • (Boolean)


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

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

#amarok_exists?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 126

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

#aplay_exists?Boolean

Returns:

  • (Boolean)


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

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)


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

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

#ffmpeg_exists?Boolean

Returns:

  • (Boolean)


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

def ffmpeg_exists?
  `which ffmpeg`.match(/ffmpeg$/) ? true : false
end

#flac_playerObject



67
68
69
70
71
72
73
74
75
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 67

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



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 27

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)


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

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

#mpg321_exists?Boolean

Returns:

  • (Boolean)


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

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

#mplayer_exists?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 118

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

#music123_exists?Boolean

Returns:

  • (Boolean)


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

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

#ogg123_exists?Boolean

Returns:

  • (Boolean)


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

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
22
23
24
25
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 5

def ogg_player
  if ogg123_exists?
    "ogg123"
  elsif music123_exists?
    "music123"
  elsif ffmpeg_exists?
    "ffmpeg -i"
  elsif vlc_exists?
    # http://askubuntu.com/questions/548915/how-to-run-cvlc-closing-after-the-play
    # https://wiki.videolan.org/VLC_command-line_help/
    "/Applications/VLC.app/Contents/MacOS/VLC --play-and-exit --no-interact -I rc"
  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)


122
123
124
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 122

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

#vlc_exists?Boolean

Returns:

  • (Boolean)


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

def vlc_exists?
  `which /Applications/VLC.app/Contents/MacOS/VLC`.match(/\/Contents\/MacOS\/VLC/)
end

#wav_playerObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 53

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



50
51
# File 'lib/jimmy_jukebox/music_player_detector.rb', line 50

def wma_player
end