jimmy_jukebox 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/jimmy_jukebox.rb +1 -0
- data/lib/jimmy_jukebox/artists.rb +2 -0
- data/lib/jimmy_jukebox/music_player_detector.rb +123 -0
- data/lib/jimmy_jukebox/song.rb +6 -2
- data/lib/jimmy_jukebox/songs/HoraceSilver.yml +2 -0
- data/lib/jimmy_jukebox/songs/PaulWhiteman.yml +5 -0
- data/lib/jimmy_jukebox/songs/ScottJoplin.yml +11 -0
- data/lib/jimmy_jukebox/user_config.rb +15 -78
- data/lib/jimmy_jukebox/version.rb +1 -1
- data/spec/music_player_detector_spec.rb +76 -0
- data/spec/user_config_spec.rb +9 -82
- metadata +7 -1
data/lib/jimmy_jukebox.rb
CHANGED
@@ -41,10 +41,12 @@ module Artists
|
|
41
41
|
mr: { genre: 'CLASSICAL', name: "maurice_ravel"},
|
42
42
|
odjb: { genre: 'JAZZ', name: "original_dixieland_jazz_band"},
|
43
43
|
op: { genre: 'JAZZ', name: "oscar_peterson"},
|
44
|
+
pw: { genre: 'JAZZ', name: "paul_whiteman"},
|
44
45
|
rt: { genre: 'JAZZ', name: "ragtime"},
|
45
46
|
rn: { genre: 'JAZZ', name: "red_norvo"},
|
46
47
|
fs: { genre: 'CLASSICAL', name: "franz_schubert"},
|
47
48
|
sb: { genre: 'JAZZ', name: "sidney_bechet"},
|
49
|
+
sj: { genre: 'JAZZ', name: "scott_joplin"},
|
48
50
|
v: { genre: 'CLASSICAL', name: "vivaldi"},
|
49
51
|
wam: { genre: 'CLASSICAL', name: "mozart"}
|
50
52
|
}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
module JimmyJukebox
|
2
|
+
|
3
|
+
class MusicPlayerDetector
|
4
|
+
|
5
|
+
def ogg_player
|
6
|
+
if ogg123_exists?
|
7
|
+
"ogg123"
|
8
|
+
elsif music123_exists?
|
9
|
+
"music123"
|
10
|
+
elsif afplay_exists?
|
11
|
+
"afplay"
|
12
|
+
elsif mplayer_exists?
|
13
|
+
"mplayer -nolirc -noconfig all"
|
14
|
+
elsif play_exists?
|
15
|
+
"play"
|
16
|
+
elsif cvlc_exists?
|
17
|
+
"cvlc --play-and-exit -q"
|
18
|
+
elsif amarok_exists?
|
19
|
+
"amarok"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def mp3_player
|
24
|
+
if mpg123_exists?
|
25
|
+
"mpg123"
|
26
|
+
elsif mpg321_exists?
|
27
|
+
"mpg321"
|
28
|
+
elsif music123_exists?
|
29
|
+
"music123"
|
30
|
+
elsif afplay_exists?
|
31
|
+
"afplay"
|
32
|
+
elsif mplayer_exists?
|
33
|
+
"mplayer -nolirc -noconfig all"
|
34
|
+
elsif play_exists?
|
35
|
+
"play"
|
36
|
+
elsif cvlc_exists?
|
37
|
+
"cvlc --play-and-exit -q"
|
38
|
+
elsif amarok_exists?
|
39
|
+
"amarok"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def aac_player
|
44
|
+
end
|
45
|
+
|
46
|
+
def wma_player
|
47
|
+
end
|
48
|
+
|
49
|
+
def wav_player
|
50
|
+
if cvlc_exists?
|
51
|
+
"cvlc --play-and-exit -q"
|
52
|
+
elsif play_exists?
|
53
|
+
"play"
|
54
|
+
elsif mplayer_exists?
|
55
|
+
"mplayer -nolirc -noconfig all"
|
56
|
+
elsif aplay_exists?
|
57
|
+
"aplay"
|
58
|
+
elsif amarok_exists?
|
59
|
+
"amarok"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def flac_player
|
64
|
+
if cvlc_exists?
|
65
|
+
"cvlc --play-and-exit -q"
|
66
|
+
elsif play_exists?
|
67
|
+
"play"
|
68
|
+
elsif mplayer_exists?
|
69
|
+
"mplayer -nolirc -noconfig all"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# can't figure out how to play just one song
|
74
|
+
def mpc_exists?
|
75
|
+
`which mpc`.match(/.*\/mpc$/) ? true : false
|
76
|
+
end
|
77
|
+
|
78
|
+
# other players possibly worth enabling
|
79
|
+
# https://xmms2.org/wiki/Using_the_application
|
80
|
+
|
81
|
+
def cvlc_exists?
|
82
|
+
`which cvlc`.match(/.*\/cvlc$/) ? true : false
|
83
|
+
end
|
84
|
+
|
85
|
+
def aplay_exists?
|
86
|
+
`which aplay`.match(/.*\/aplay$/) ? true : false
|
87
|
+
end
|
88
|
+
|
89
|
+
def ogg123_exists?
|
90
|
+
`which ogg123`.match(/.*\/ogg123$/) ? true : false
|
91
|
+
end
|
92
|
+
|
93
|
+
def mpg123_exists?
|
94
|
+
`which mpg123`.match(/.*\/mpg123$/) ? true : false
|
95
|
+
end
|
96
|
+
|
97
|
+
def music123_exists?
|
98
|
+
`which music123`.match(/.*\/music123$/) ? true : false
|
99
|
+
end
|
100
|
+
|
101
|
+
def mpg321_exists?
|
102
|
+
`which mpg321`.match(/.*\/mpg321$/) ? true : false
|
103
|
+
end
|
104
|
+
|
105
|
+
def afplay_exists?
|
106
|
+
`which afplay`.match(/.*\/afplay$/) ? true : false
|
107
|
+
end
|
108
|
+
|
109
|
+
def mplayer_exists?
|
110
|
+
`which mplayer`.match(/.*\/mplayer$/) ? true : false
|
111
|
+
end
|
112
|
+
|
113
|
+
def play_exists?
|
114
|
+
`which play`.match(/.*\/play$/) ? true : false
|
115
|
+
end
|
116
|
+
|
117
|
+
def amarok_exists?
|
118
|
+
`which amarok`.match(/.*\/amarok$/) ? true : false
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
data/lib/jimmy_jukebox/song.rb
CHANGED
@@ -31,10 +31,10 @@ module JimmyJukebox
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def set_music_file(in_music_file)
|
34
|
-
if in_music_file =~ /\.mp3$/i || in_music_file =~ /\.ogg$/i
|
34
|
+
if in_music_file =~ /\.mp3$/i || in_music_file =~ /\.ogg$/i || in_music_file =~ /\.wav$/i || in_music_file =~ /.flac$/i
|
35
35
|
@music_file = File.expand_path(in_music_file)
|
36
36
|
else
|
37
|
-
raise InvalidSongFormatException, "JimmyJukebox plays only .mp3/.ogg files. #{in_music_file} is not valid"
|
37
|
+
raise InvalidSongFormatException, "JimmyJukebox plays only .mp3/.ogg/.flac/.wav files. #{in_music_file} is not valid"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -96,6 +96,10 @@ module JimmyJukebox
|
|
96
96
|
self.player = user_config.mp3_player
|
97
97
|
elsif music_file =~ /\.ogg$/i
|
98
98
|
self.player = user_config.ogg_player
|
99
|
+
elsif music_file =~ /\.wav$/i
|
100
|
+
self.player = user_config.wav_player
|
101
|
+
elsif music_file =~ /\.flac$/i
|
102
|
+
self.player = user_config.flac_player
|
99
103
|
else
|
100
104
|
raise UnsupportedSongFormatException, "Attempted to play a file format this program cannot play"
|
101
105
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
---
|
2
|
+
- http://archive.org/download/PaulWhiteman-4UneditedWavFiles-TwoUncommon/InaBoat.wav
|
3
|
+
- http://archive.org/download/PaulWhiteman-4UneditedWavFiles-TwoUncommon/Sweetheart.wav
|
4
|
+
- http://archive.org/download/PaulWhiteman-4UneditedWavFiles-TwoUncommon/TheJapaneseSandman.wav
|
5
|
+
- http://archive.org/download/PaulWhiteman-4UneditedWavFiles-TwoUncommon/Whispering.wav
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
- http://archive.org/download/ScottJoplinsMapleLeafRag/MapleLeafRag.mp3
|
3
|
+
- http://archive.org/download/WeepingWillowRagScottJoplin1903/weepingWillowRagScottJoplin1903RagtimePianoRollLegend.mp3
|
4
|
+
- http://archive.org/download/ScottJoplin-01-06/ScottJoplin-JosephLamb1908.mp3
|
5
|
+
- http://archive.org/download/ScottJoplin-01-06/ScottJoplin-OriginalRagspianoRoll1900.mp3
|
6
|
+
- http://archive.org/download/ScottJoplin-01-06/ScottJoplin-PianoRollBlues1900.mp3
|
7
|
+
- http://archive.org/download/ScottJoplin-01-06/ScottJoplin-PineappleRag1908.mp3
|
8
|
+
- http://archive.org/download/ScottJoplin-01-06/ScottJoplin-RagtimeDance1906.mp3
|
9
|
+
- http://archive.org/download/ScottJoplin-TheEntertainer1902/ScottJoplin-TheEntertainer1902.mp3
|
10
|
+
- http://archive.org/download/MapleLeafRag/MapleLeafRag_vbr.mp3
|
11
|
+
- http://archive.org/download/MapleLeafRag/MapleLeafRag.mp3
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
require 'jimmy_jukebox/artists'
|
4
|
+
require 'jimmy_jukebox/music_player_detector'
|
4
5
|
include Artists
|
5
6
|
|
6
7
|
module JimmyJukebox
|
@@ -21,7 +22,7 @@ module JimmyJukebox
|
|
21
22
|
class UserConfig
|
22
23
|
|
23
24
|
attr_writer :music_directories
|
24
|
-
attr_accessor :songs, :ogg_player, :mp3_player
|
25
|
+
attr_accessor :songs, :ogg_player, :mp3_player, :wav_player, :flac_player
|
25
26
|
|
26
27
|
DEFAULT_PLAYLIST_DIR = File.expand_path(File.join("~",".jimmy_jukebox"))
|
27
28
|
|
@@ -71,88 +72,24 @@ module JimmyJukebox
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def set_music_players
|
74
|
-
|
75
|
-
|
75
|
+
detector = MusicPlayerDetector.new
|
76
|
+
self.ogg_player = detector.ogg_player
|
77
|
+
self.mp3_player = detector.mp3_player
|
78
|
+
self.wav_player = detector.wav_player
|
79
|
+
self.flac_player = detector.flac_player
|
76
80
|
no_player_configured unless ogg_player || mp3_player
|
77
81
|
warn_about_partial_functionality if !ogg_player || !mp3_player
|
78
82
|
end
|
79
83
|
|
80
84
|
def no_player_configured
|
81
|
-
puts "*** YOU CANNOT PLAY MP3S OR OGG FILES -- YOU
|
85
|
+
puts "*** YOU CANNOT PLAY MP3S OR OGG FILES -- YOU'LL PROBABLY NEED TO INSTALL AN OGG PLAYER (like ogg123) AND AN MP3 PLAYER (like mpg123) BEFORE USING JIMMYJUKEBOX ***"
|
82
86
|
exit
|
83
87
|
end
|
84
88
|
|
85
89
|
def warn_about_partial_functionality
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
puts "*** YOU CANNOT PLAY OGG FILES -- YOU MIGHT WANT TO INSTALL OGG123 ***"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def set_ogg_player
|
94
|
-
if ogg123_exists?
|
95
|
-
self.ogg_player = "ogg123"
|
96
|
-
return
|
97
|
-
elsif music123_exists?
|
98
|
-
self.ogg_player = "music123"
|
99
|
-
return
|
100
|
-
elsif afplay_exists?
|
101
|
-
self.ogg_player = "afplay"
|
102
|
-
return
|
103
|
-
elsif mplayer_exists?
|
104
|
-
self.ogg_player = "mplayer -nolirc -noconfig all"
|
105
|
-
elsif play_exists?
|
106
|
-
self.ogg_player = "play"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def set_mp3_player
|
111
|
-
if mpg123_exists?
|
112
|
-
self.mp3_player = "mpg123"
|
113
|
-
return
|
114
|
-
elsif mpg321_exists?
|
115
|
-
self.mp3_player = "mpg321"
|
116
|
-
return
|
117
|
-
elsif music123_exists?
|
118
|
-
self.mp3_player = "music123"
|
119
|
-
return
|
120
|
-
elsif afplay_exists?
|
121
|
-
self.mp3_player = "afplay"
|
122
|
-
return
|
123
|
-
elsif mplayer_exists?
|
124
|
-
self.mp3_player = "mplayer -nolirc -noconfig all"
|
125
|
-
elsif play_exists?
|
126
|
-
self.mp3_player = "play"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def ogg123_exists?
|
131
|
-
`which ogg123`.match(/.*\/ogg123$/) ? true : false
|
132
|
-
end
|
133
|
-
|
134
|
-
def mpg123_exists?
|
135
|
-
`which mpg123`.match(/.*\/mpg123$/) ? true : false
|
136
|
-
end
|
137
|
-
|
138
|
-
def music123_exists?
|
139
|
-
`which music123`.match(/.*\/music123$/) ? true : false
|
140
|
-
end
|
141
|
-
|
142
|
-
def mpg321_exists?
|
143
|
-
`which mpg321`.match(/.*\/mpg321$/) ? true : false
|
144
|
-
end
|
145
|
-
|
146
|
-
def afplay_exists?
|
147
|
-
`which afplay`.match(/.*\/afplay$/) ? true : false
|
148
|
-
end
|
149
|
-
|
150
|
-
def mplayer_exists?
|
151
|
-
`which mplayer`.match(/.*\/mplayer$/) ? true : false
|
152
|
-
end
|
153
|
-
|
154
|
-
def play_exists?
|
155
|
-
`which play`.match(/.*\/play$/) ? true : false
|
90
|
+
puts "*** YOU CANNOT PLAY MP3S -- YOU MIGHT WANT TO INSTALL AN MP3 PLAYER (like mpg123 OR mpg321) ***" if !mp3_player
|
91
|
+
puts "*** YOU CANNOT PLAY OGG FILES -- YOU MIGHT WANT TO INSTALL AN OGG PLAYER (like ogg123) ***" if !ogg_player
|
92
|
+
puts "*** YOU CANNOT PLAY WAV FILES -- YOU MIGHT WANT TO INSTALL A WAV PLAYER (like vlc) ***" if !wav_player
|
156
93
|
end
|
157
94
|
|
158
95
|
def set_music_directories_from_file
|
@@ -185,10 +122,10 @@ module JimmyJukebox
|
|
185
122
|
music_directories << dir
|
186
123
|
elsif ARTISTS.keys.include?(ARGV[0].to_sym)
|
187
124
|
music_directories << default_music_dir + artist_key_to_subdir_name(ARGV[0].to_sym)
|
188
|
-
elsif is_a_txt_file?(ARGV[0])
|
125
|
+
elsif is_a_txt_file?(ARGV[0].strip)
|
189
126
|
set_music_directories_from_file
|
190
|
-
elsif is_a_directory?(ARGV[0])
|
191
|
-
music_directories << File.expand_path(ARGV[0])
|
127
|
+
elsif is_a_directory?(ARGV[0].strip)
|
128
|
+
music_directories << File.expand_path(ARGV[0].strip)
|
192
129
|
else
|
193
130
|
music_directories << default_music_dir
|
194
131
|
end
|
@@ -241,7 +178,7 @@ module JimmyJukebox
|
|
241
178
|
if "".respond_to?(:force_encoding) # Ruby 1.8 doesn't have string encoding or String#force_encoding
|
242
179
|
files.delete_if { |f| !f.force_encoding("UTF-8").valid_encoding? } # avoid "invalid byte sequence in UTF-8 (ArgumentError)"
|
243
180
|
end
|
244
|
-
files.delete_if { |f| !f.match(/.*\.mp3/i) && !f.match(/.*\.ogg/i) }
|
181
|
+
files.delete_if { |f| !f.match(/.*\.mp3/i) && !f.match(/.*\.ogg/i) && !f.match(/.*\.wav/i) && !f.match(/.*\.flac/i) }
|
245
182
|
files.map! { |f| File.expand_path(music_dir) + '/' + f }
|
246
183
|
files.each { |f| songs << f }
|
247
184
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/jimmy_jukebox/music_player_detector'
|
3
|
+
include JimmyJukebox
|
4
|
+
|
5
|
+
describe MusicPlayerDetector do
|
6
|
+
|
7
|
+
include FakeFS::SpecHelpers
|
8
|
+
|
9
|
+
let(:detector) { MusicPlayerDetector.new }
|
10
|
+
|
11
|
+
before(:all) do
|
12
|
+
ARGV.clear
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "#ogg_player" do
|
16
|
+
|
17
|
+
it "does not find ogg123 when not present" do
|
18
|
+
detector.should_receive(:`).with("which ogg123").and_return("")
|
19
|
+
detector.should_receive(:`).with("which music123").and_return("/usr/bin/music123")
|
20
|
+
detector.ogg_player.should == 'music123'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "finds ogg123 when present" do
|
24
|
+
detector.should_receive(:`).with("which ogg123").and_return("/usr/bin/ogg123")
|
25
|
+
detector.ogg_player.should == 'ogg123'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "finds afplay when present" do
|
29
|
+
detector.should_receive(:`).with("which ogg123").and_return("")
|
30
|
+
detector.should_receive(:`).with("which music123").and_return("")
|
31
|
+
detector.should_receive(:`).with("which afplay").and_return("/usr/bin/afplay")
|
32
|
+
detector.ogg_player.should == 'afplay'
|
33
|
+
end
|
34
|
+
|
35
|
+
it "finds mplayer when present" do
|
36
|
+
detector.should_receive(:`).with("which ogg123").and_return("")
|
37
|
+
detector.should_receive(:`).with("which music123").and_return("")
|
38
|
+
detector.should_receive(:`).with("which afplay").and_return("")
|
39
|
+
detector.should_receive(:`).with("which mplayer").and_return("/usr/bin/mplayer")
|
40
|
+
detector.ogg_player.should == 'mplayer -nolirc -noconfig all'
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#mp3_player" do
|
46
|
+
|
47
|
+
it "does not find mpg123 when not present" do
|
48
|
+
detector.should_receive(:`).with("which mpg123").and_return("")
|
49
|
+
detector.should_receive(:`).with("which mpg321").and_return("/usr/bin/mpg321")
|
50
|
+
detector.mp3_player.should == 'mpg321'
|
51
|
+
end
|
52
|
+
|
53
|
+
it "finds mpg123 when present" do
|
54
|
+
detector.should_receive(:`).with("which mpg123").and_return("/usr/bin/mpg123")
|
55
|
+
detector.mp3_player.should == 'mpg123'
|
56
|
+
end
|
57
|
+
|
58
|
+
it "finds music123 when present" do
|
59
|
+
detector.should_receive(:`).with("which mpg123").and_return("")
|
60
|
+
detector.should_receive(:`).with("which mpg321").and_return("")
|
61
|
+
detector.should_receive(:`).with("which music123").and_return("/usr/bin/music123")
|
62
|
+
detector.mp3_player.should == 'music123'
|
63
|
+
end
|
64
|
+
|
65
|
+
it "finds mplayer when present" do
|
66
|
+
detector.should_receive(:`).with("which mpg123").and_return("")
|
67
|
+
detector.should_receive(:`).with("which mpg321").and_return("")
|
68
|
+
detector.should_receive(:`).with("which music123").and_return("")
|
69
|
+
detector.should_receive(:`).with("which afplay").and_return("")
|
70
|
+
detector.should_receive(:`).with("which mplayer").and_return("/usr/bin/mplayer")
|
71
|
+
detector.mp3_player.should == 'mplayer -nolirc -noconfig all'
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/spec/user_config_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'fileutils'
|
2
3
|
require File.dirname(__FILE__) + '/../lib/jimmy_jukebox/user_config'
|
3
4
|
include JimmyJukebox
|
4
5
|
|
@@ -24,6 +25,14 @@ describe UserConfig do
|
|
24
25
|
#
|
25
26
|
#end
|
26
27
|
|
28
|
+
describe "#is_a_directory?" do
|
29
|
+
it "accepts relative paths" do
|
30
|
+
dir = '~/Music/JAZZ/Art_Tatum'
|
31
|
+
FileUtils.mkdir_p(File.expand_path(dir))
|
32
|
+
UserConfig.new.is_a_directory?(dir).should be_true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
27
36
|
describe "#shortcuts" do
|
28
37
|
|
29
38
|
it "finds dirs based on regex keys" do
|
@@ -109,88 +118,6 @@ describe UserConfig do
|
|
109
118
|
|
110
119
|
end
|
111
120
|
|
112
|
-
it "does not complain when ogg123 & mpg123 both installed" do
|
113
|
-
uc.should_receive(:`).with("which ogg123").and_return("/usr/bin/ogg123")
|
114
|
-
uc.should_receive(:`).with("which mpg123").and_return("/usr/bin/mpg123")
|
115
|
-
uc.should_not_receive(:puts)
|
116
|
-
uc.send(:set_music_players)
|
117
|
-
uc.instance_variable_get(:@ogg_player).should == "ogg123"
|
118
|
-
uc.instance_variable_get(:@mp3_player).should == "mpg123"
|
119
|
-
end
|
120
|
-
|
121
|
-
it "does not complain when ogg123 & mpg321 both installed but not mpg123" do
|
122
|
-
uc.should_receive(:`).with("which ogg123").and_return("/usr/bin/ogg123")
|
123
|
-
uc.should_receive(:`).with("which mpg123").and_return("")
|
124
|
-
uc.should_receive(:`).with("which mpg321").and_return("/usr/bin/mpg321")
|
125
|
-
uc.should_not_receive(:puts)
|
126
|
-
uc.send(:set_music_players)
|
127
|
-
uc.instance_variable_get(:@ogg_player).should == "ogg123"
|
128
|
-
uc.instance_variable_get(:@mp3_player).should == "mpg321"
|
129
|
-
end
|
130
|
-
|
131
|
-
it "complains when ogg123 installed but mpg123, mpg321, music123, afplay & play not installed" do
|
132
|
-
uc.instance_variable_set(:@ogg_player, nil)
|
133
|
-
uc.instance_variable_set(:@mp3_player, nil)
|
134
|
-
uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("/usr/bin/ogg123")
|
135
|
-
uc.should_receive(:`).at_least(:once).with("which mpg123").and_return("")
|
136
|
-
uc.should_receive(:`).at_least(:once).with("which mpg321").and_return("")
|
137
|
-
uc.should_receive(:`).at_least(:once).with("which music123").and_return("")
|
138
|
-
uc.should_receive(:`).at_least(:once).with("which afplay").and_return("")
|
139
|
-
uc.should_receive(:`).at_least(:once).with("which mplayer").and_return("")
|
140
|
-
uc.should_receive(:`).at_least(:once).with("which play").and_return("")
|
141
|
-
uc.should_receive(:puts).with("*** YOU CANNOT PLAY MP3S -- YOU MIGHT WANT TO INSTALL MPG123 OR MPG321 ***")
|
142
|
-
uc.send(:set_music_players)
|
143
|
-
uc.instance_variable_get(:@ogg_player).should == "ogg123"
|
144
|
-
uc.instance_variable_get(:@mp3_player).should be_false
|
145
|
-
end
|
146
|
-
|
147
|
-
it "complains when mpg123 installed but ogg123, mpg321, music123, afplay & play not installed" do
|
148
|
-
uc.instance_variable_set(:@ogg_player, nil)
|
149
|
-
uc.instance_variable_set(:@mp3_player, nil)
|
150
|
-
uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
|
151
|
-
uc.should_receive(:`).at_least(:once).with("which music123").and_return("")
|
152
|
-
uc.should_receive(:`).at_least(:once).with("which mpg123").and_return("/usr/bin/mpg123")
|
153
|
-
uc.should_receive(:`).at_least(:once).with("which afplay").and_return("")
|
154
|
-
uc.should_receive(:`).at_least(:once).with("which mplayer").and_return("")
|
155
|
-
uc.should_receive(:`).at_least(:once).with("which play").and_return("")
|
156
|
-
uc.should_receive(:puts).with("*** YOU CANNOT PLAY OGG FILES -- YOU MIGHT WANT TO INSTALL OGG123 ***")
|
157
|
-
uc.send(:set_music_players)
|
158
|
-
uc.instance_variable_get(:@ogg_player).should be_false
|
159
|
-
uc.instance_variable_get(:@mp3_player).should == "mpg123"
|
160
|
-
end
|
161
|
-
|
162
|
-
it "complains when mpg321 installed but mpg123, music123, ogg123, afplay & play not installed" do
|
163
|
-
uc.instance_variable_set(:@ogg_player, nil)
|
164
|
-
uc.instance_variable_set(:@mp3_player, nil)
|
165
|
-
uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
|
166
|
-
uc.should_receive(:`).at_least(:once).with("which mpg123").and_return("")
|
167
|
-
uc.should_receive(:`).at_least(:once).with("which music123").and_return("")
|
168
|
-
uc.should_receive(:`).at_least(:once).with("which mpg321").and_return("/usr/bin/mpg321")
|
169
|
-
uc.should_receive(:`).at_least(:once).with("which afplay").and_return("")
|
170
|
-
uc.should_receive(:`).at_least(:once).with("which mplayer").and_return("")
|
171
|
-
uc.should_receive(:`).at_least(:once).with("which play").and_return("")
|
172
|
-
uc.should_receive(:puts).with("*** YOU CANNOT PLAY OGG FILES -- YOU MIGHT WANT TO INSTALL OGG123 ***")
|
173
|
-
uc.send(:set_music_players)
|
174
|
-
uc.instance_variable_get(:@ogg_player).should be_false
|
175
|
-
uc.instance_variable_get(:@mp3_player).should == "mpg321"
|
176
|
-
end
|
177
|
-
|
178
|
-
it "prints message and exits when mpg123, mpg321, ogg123, music123, afplay & play all not installed" do
|
179
|
-
uc.instance_variable_set(:@ogg_player, nil)
|
180
|
-
uc.instance_variable_set(:@mp3_player, nil)
|
181
|
-
uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
|
182
|
-
uc.should_receive(:`).at_least(:once).with("which mpg123").and_return("")
|
183
|
-
uc.should_receive(:`).at_least(:once).with("which music123").and_return("")
|
184
|
-
uc.should_receive(:`).at_least(:once).with("which mpg321").and_return("")
|
185
|
-
uc.should_receive(:`).at_least(:once).with("which afplay").and_return("")
|
186
|
-
uc.should_receive(:`).at_least(:once).with("which mplayer").and_return("")
|
187
|
-
uc.should_receive(:`).at_least(:once).with("which play").and_return("")
|
188
|
-
error_msg = "*** YOU CANNOT PLAY MP3S OR OGG FILES -- YOU MIGHT WANT TO INSTALL ogg123 AND mpg123/mpg321 BEFORE USING JIMMYJUKEBOX ***"
|
189
|
-
uc.should_receive(:puts).with(error_msg)
|
190
|
-
lambda { uc.send(:set_music_players) }.should raise_error SystemExit
|
191
|
-
end
|
192
|
-
|
193
121
|
end
|
194
122
|
|
195
123
|
end
|
196
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jimmy_jukebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/jimmy_jukebox/song.rb
|
125
125
|
- lib/jimmy_jukebox/jukebox.rb
|
126
126
|
- lib/jimmy_jukebox/display_options.rb
|
127
|
+
- lib/jimmy_jukebox/music_player_detector.rb
|
127
128
|
- lib/jimmy_jukebox/user_config.rb
|
128
129
|
- lib/jimmy_jukebox/user_interface.rb
|
129
130
|
- lib/jimmy_jukebox/song_loader.rb
|
@@ -147,13 +148,16 @@ files:
|
|
147
148
|
- lib/jimmy_jukebox/songs/DjangoReinhardt.yml
|
148
149
|
- lib/jimmy_jukebox/songs/RedNorvo.yml
|
149
150
|
- lib/jimmy_jukebox/songs/Mendelssohn.yml
|
151
|
+
- lib/jimmy_jukebox/songs/ScottJoplin.yml
|
150
152
|
- lib/jimmy_jukebox/songs/LionelHampton.yml
|
151
153
|
- lib/jimmy_jukebox/songs/ArtTatum.yml
|
152
154
|
- lib/jimmy_jukebox/songs/BixBeiderbecke.yml
|
153
155
|
- lib/jimmy_jukebox/songs/ArtieShaw.yml
|
154
156
|
- lib/jimmy_jukebox/songs/MilesDavis.yml
|
157
|
+
- lib/jimmy_jukebox/songs/HoraceSilver.yml
|
155
158
|
- lib/jimmy_jukebox/songs/BudPowell.yml
|
156
159
|
- lib/jimmy_jukebox/songs/ChuckBerry.yml
|
160
|
+
- lib/jimmy_jukebox/songs/PaulWhiteman.yml
|
157
161
|
- lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
|
158
162
|
- lib/jimmy_jukebox/songs/CannonballAdderley.yml
|
159
163
|
- lib/jimmy_jukebox/songs/DizzyGillespie.yml
|
@@ -182,6 +186,7 @@ files:
|
|
182
186
|
- spec/song_loader_spec.rb
|
183
187
|
- spec/user_config_spec.rb
|
184
188
|
- spec/artists_spec.rb
|
189
|
+
- spec/music_player_detector_spec.rb
|
185
190
|
- spec/song_spec.rb
|
186
191
|
- spec/spec_helper.rb
|
187
192
|
- bin/play_jukebox
|
@@ -216,6 +221,7 @@ test_files:
|
|
216
221
|
- spec/song_loader_spec.rb
|
217
222
|
- spec/user_config_spec.rb
|
218
223
|
- spec/artists_spec.rb
|
224
|
+
- spec/music_player_detector_spec.rb
|
219
225
|
- spec/song_spec.rb
|
220
226
|
- spec/spec_helper.rb
|
221
227
|
has_rdoc:
|