jimmy_jukebox 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/play_jukebox +1 -9
- data/lib/jimmy_jukebox/artists.rb +1 -0
- data/lib/jimmy_jukebox/jukebox.rb +1 -0
- data/lib/jimmy_jukebox/song.rb +0 -1
- data/lib/jimmy_jukebox/songs/BudPowell.yml +3 -0
- data/lib/jimmy_jukebox/songs/CecilTaylor.yml +3 -0
- data/lib/jimmy_jukebox/songs/MilesDavis.yml +23 -0
- data/lib/jimmy_jukebox/songs/Monk.yml +3 -0
- data/lib/jimmy_jukebox/songs/OscarPeterson.yml +11 -0
- data/lib/jimmy_jukebox/user_config.rb +17 -15
- data/lib/jimmy_jukebox/user_interface.rb +12 -6
- data/lib/jimmy_jukebox/version.rb +1 -1
- metadata +5 -1
data/bin/play_jukebox
CHANGED
@@ -5,27 +5,19 @@ $running_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGIN
|
|
5
5
|
if $running_jruby
|
6
6
|
begin
|
7
7
|
require 'spoon'
|
8
|
-
require 'readline'
|
9
8
|
rescue LoadError => e
|
10
9
|
if e.message =~ /spoon/
|
11
10
|
p "*** You must run 'gem install spoon' before using JimmyJukebox on JRuby ***"
|
12
11
|
exit
|
13
|
-
elsif e.message =~ /readline/
|
14
|
-
p "*** You must install 'readline' to use JimmyJukebox on JRuby ***"
|
15
|
-
exit
|
16
12
|
else
|
17
13
|
raise
|
18
14
|
end
|
19
15
|
end
|
20
16
|
else
|
21
17
|
begin
|
22
|
-
require 'readline'
|
23
18
|
require 'posix/spawn'
|
24
19
|
rescue LoadError => e
|
25
|
-
if e.message =~ /
|
26
|
-
p "*** You must install 'readline' or the 'rb-readline' gem to use JimmyJukebox in Ruby ***"
|
27
|
-
exit
|
28
|
-
elsif e.message =~ /posix/ || e.message =~ /spawn/
|
20
|
+
if e.message =~ /posix/ || e.message =~ /spawn/
|
29
21
|
p "*** You must run 'gem install posix-spawn' before using JimmyJukebox in Ruby ***"
|
30
22
|
exit
|
31
23
|
else
|
@@ -31,6 +31,7 @@ module Artists
|
|
31
31
|
m: { genre: 'CLASSICAL', name: "mendelssohn"},
|
32
32
|
md: { genre: 'JAZZ', name: "miles_davis"},
|
33
33
|
odjb: { genre: 'JAZZ', name: "original_dixieland_jazz_band"},
|
34
|
+
op: { genre: 'JAZZ', name: "oscar_peterson"},
|
34
35
|
rt: { genre: 'JAZZ', name: "ragtime"},
|
35
36
|
rn: { genre: 'JAZZ', name: "red_norvo"},
|
36
37
|
fs: { genre: 'CLASSICAL', name: "franz_schubert"},
|
@@ -136,6 +136,7 @@ module JimmyJukebox
|
|
136
136
|
self.songs_played << song
|
137
137
|
current_song.play(user_config, self)
|
138
138
|
p "Finished playing"
|
139
|
+
p '-------------------------------------'
|
139
140
|
self.current_song = nil
|
140
141
|
self.playing = false
|
141
142
|
rescue Song::SongTerminatedPrematurelyException
|
data/lib/jimmy_jukebox/song.rb
CHANGED
@@ -125,7 +125,6 @@ module JimmyJukebox
|
|
125
125
|
p "Now playing '#{music_file}'"
|
126
126
|
p "Press Ctrl-C to stop the music and exit this program"
|
127
127
|
run_command(player, music_file)
|
128
|
-
p "playing_pid = " + playing_pid.to_s
|
129
128
|
Process.waitpid(playing_pid) # Waits for a child process to exit, returns its process id, and sets $? to a Process::Status object
|
130
129
|
$? # return Process::Status object with instance methods .stopped?, .exited?, .exitstatus
|
131
130
|
end
|
@@ -1,4 +1,27 @@
|
|
1
1
|
---
|
2
|
+
- http://archive.org/download/BirthOfTheCool/01-Move2.32.mp3
|
3
|
+
- http://archive.org/download/BirthOfTheCool/02-Jeru3.11.mp3
|
4
|
+
- http://archive.org/download/BirthOfTheCool/03-MoonDreams3.18.mp3
|
5
|
+
- http://archive.org/download/BirthOfTheCool/04-VenusDeMilo3.10.mp3
|
6
|
+
- http://archive.org/download/BirthOfTheCool/05-Budo2.33.mp3
|
7
|
+
- http://archive.org/download/BirthOfTheCool/06-Deception2.47.mp3
|
8
|
+
- http://archive.org/download/BirthOfTheCool/07-Godchild3.08.mp3
|
9
|
+
- http://archive.org/download/BirthOfTheCool/08-Boplicity2.59.mp3
|
10
|
+
- http://archive.org/download/BirthOfTheCool/09-Rocker3.04.mp3
|
11
|
+
- http://archive.org/download/BirthOfTheCool/10-Israel2.16.mp3
|
12
|
+
- http://archive.org/download/BirthOfTheCool/11-Rouge3.13.mp3
|
13
|
+
- http://archive.org/download/BirthOfTheCool/12-DarnThatDream3.22.mp3
|
14
|
+
- http://archive.org/download/BirthOfTheCool/13-BirthOfTheCoolTheme0.17.mp3
|
15
|
+
- http://archive.org/download/BirthOfTheCool/14-SymphonySidAnnoucesTheBand1.02.mp3
|
16
|
+
- http://archive.org/download/BirthOfTheCool/15-Move3.40.mp3
|
17
|
+
- http://archive.org/download/BirthOfTheCool/16-WhyILoveYou3.40.mp3
|
18
|
+
- http://archive.org/download/BirthOfTheCool/17-Godchild5.49.mp3
|
19
|
+
- http://archive.org/download/BirthOfTheCool/18-SymphonySidIntroduction0.25.mp3
|
20
|
+
- http://archive.org/download/BirthOfTheCool/19-SilVousPlait4.23.mp3
|
21
|
+
- http://archive.org/download/BirthOfTheCool/20-MoonDreams3.05.mp3
|
22
|
+
- http://archive.org/download/BirthOfTheCool/21-Budo3.24.mp3
|
23
|
+
- http://archive.org/download/BirthOfTheCool/22-DarnThatDream4.23.mp3
|
24
|
+
- http://archive.org/download/BirthOfTheCool/23-Move4.47.mp3
|
2
25
|
- http://archive.org/download/MilesDavisPortia/MilesDavis-Tutu-03.Portia.mp3
|
3
26
|
- http://archive.org/download/MilesDavisAtCarnegieHall/01-SoWhat.mp3
|
4
27
|
- http://archive.org/download/MilesDavisAtCarnegieHall/01-SomedayMyPrinceWillCome.mp3
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
- http://archive.org/download/OscarPetersonTrio-BagsGroove/04-bagsGroove.mp3
|
3
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/107MeanToMe.mp3
|
4
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/108HowLongHasThisBeenGoingOn.mp3
|
5
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/109WhenYourLoverHasGone.mp3
|
6
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/110MoreThanYouKnow.mp3
|
7
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/111TheresALullInMyLife.mp3
|
8
|
+
- http://archive.org/download/EllaFitzgeraldOscarPeterson/112MidnightSun.mp3
|
9
|
+
- http://archive.org/download/OscarPeterson-InTheStillOfTheNight/01-InTheStillOfTheNight.mp3
|
10
|
+
- http://archive.org/download/BenWebster-colemanHawkins-oscarPeterson-ItNeverEnteredMyMind/BenWebster-colemanHawkins-oscarPeterson-ItNeverEnteredMyMind.mp3
|
11
|
+
- http://archive.org/download/ZappologyMr.Chops./Mr.Chops..mp3
|
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
require 'fileutils'
|
2
2
|
|
3
|
-
|
3
|
+
require 'jimmy_jukebox/artists'
|
4
|
+
include Artists
|
4
5
|
|
5
|
-
|
6
|
+
module JimmyJukebox
|
6
7
|
|
7
|
-
|
8
|
-
include Artists
|
8
|
+
class UserConfig
|
9
9
|
|
10
10
|
attr_writer :music_directories
|
11
11
|
attr_accessor :songs, :ogg_player, :mp3_player
|
@@ -30,6 +30,14 @@ module JimmyJukebox
|
|
30
30
|
File.expand_path(File.join("~","Music"))
|
31
31
|
end
|
32
32
|
|
33
|
+
def jazz_dir
|
34
|
+
default_music_dir + '/JAZZ'
|
35
|
+
end
|
36
|
+
|
37
|
+
def classical_dir
|
38
|
+
default_music_dir + '/CLASSICAL'
|
39
|
+
end
|
40
|
+
|
33
41
|
def set_music_players
|
34
42
|
set_ogg_player
|
35
43
|
set_mp3_player
|
@@ -64,11 +72,6 @@ module JimmyJukebox
|
|
64
72
|
self.ogg_player = "mplayer -nolirc -noconfig all"
|
65
73
|
elsif play_exists?
|
66
74
|
self.ogg_player = "play"
|
67
|
-
#elsif RUBY_PLATFORM.downcase.include?('mac') || RUBY_PLATFORM.downcase.include?('darwin')
|
68
|
-
# ogg_player = "afplay"
|
69
|
-
# return
|
70
|
-
#elsif (require 'rbconfig') && ['mac','darwin'].include?(RbConfig::CONFIG['host_os'])
|
71
|
-
# ogg_player = "afplay"
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
@@ -89,11 +92,6 @@ module JimmyJukebox
|
|
89
92
|
self.mp3_player = "mplayer -nolirc -noconfig all"
|
90
93
|
elsif play_exists?
|
91
94
|
self.mp3_player = "play"
|
92
|
-
#elsif RUBY_PLATFORM.downcase.include?('mac') || RUBY_PLATFORM.downcase.include?('darwin')
|
93
|
-
# mp3_player = "afplay"
|
94
|
-
# return
|
95
|
-
#elsif (require 'rbconfig') && ['mac','darwin'].include?(RbConfig::CONFIG['host_os'])
|
96
|
-
# mp3_player = "afplay"
|
97
95
|
end
|
98
96
|
end
|
99
97
|
|
@@ -143,6 +141,10 @@ module JimmyJukebox
|
|
143
141
|
# puts "ARGV: " + ARGV.inspect + " (" + ARGV.class.to_s + ")"
|
144
142
|
if ARGV.empty?
|
145
143
|
music_directories << default_music_dir
|
144
|
+
elsif ARGV[0].strip =~ /^jazz$/i
|
145
|
+
music_directories << jazz_dir
|
146
|
+
elsif ARGV[0].strip =~ /^classical$/i
|
147
|
+
music_directories << classical_dir
|
146
148
|
elsif ARTISTS.keys.include?(ARGV[0].to_sym)
|
147
149
|
music_directories << default_music_dir + artist_key_to_subdir_name(ARGV[0].to_sym)
|
148
150
|
elsif is_a_txt_file?(ARGV[0])
|
@@ -1,4 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require 'io/console'
|
2
|
+
|
3
|
+
if $running_jruby
|
4
|
+
class IO
|
5
|
+
def getch
|
6
|
+
raw do
|
7
|
+
getc
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
2
12
|
|
3
13
|
jj = Jukebox.new
|
4
14
|
|
@@ -8,8 +18,6 @@ end
|
|
8
18
|
|
9
19
|
user_input_thread = Thread.new do
|
10
20
|
|
11
|
-
stty_save = `stty -g`.chomp # Store state of the terminal
|
12
|
-
|
13
21
|
def display_options
|
14
22
|
p "'p' = (un)pause, 'q' = quit, 'r' = replay previous song, 's' = skip this song, 'e' = erase this song"
|
15
23
|
end
|
@@ -25,8 +33,7 @@ user_input_thread = Thread.new do
|
|
25
33
|
begin
|
26
34
|
loop do
|
27
35
|
display_options_after_delay
|
28
|
-
|
29
|
-
case line.strip
|
36
|
+
case STDIN.getch
|
30
37
|
when "q", "Q"
|
31
38
|
raise Interrupt
|
32
39
|
when "e", "E"
|
@@ -54,7 +61,6 @@ user_input_thread = Thread.new do
|
|
54
61
|
rescue Interrupt, SystemExit => e
|
55
62
|
p "JimmyJukebox closed by user request. Bye!"
|
56
63
|
jj.quit
|
57
|
-
system('stty', stty_save) unless $running_jruby # Restore original terminal state
|
58
64
|
exit
|
59
65
|
end
|
60
66
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jimmy_jukebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Lavin
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/jimmy_jukebox/songs/ColemanHawkins.yml
|
148
148
|
- lib/jimmy_jukebox/songs/KingOliver.yml
|
149
149
|
- lib/jimmy_jukebox/songs/OriginalDixielandJazzBand.yml
|
150
|
+
- lib/jimmy_jukebox/songs/OscarPeterson.yml
|
150
151
|
- lib/jimmy_jukebox/songs/Dixieland.yml
|
151
152
|
- lib/jimmy_jukebox/songs/LouisArmstrong.yml
|
152
153
|
- lib/jimmy_jukebox/songs/DjangoReinhardt.yml
|
@@ -157,6 +158,7 @@ files:
|
|
157
158
|
- lib/jimmy_jukebox/songs/BixBeiderbecke.yml
|
158
159
|
- lib/jimmy_jukebox/songs/ArtieShaw.yml
|
159
160
|
- lib/jimmy_jukebox/songs/MilesDavis.yml
|
161
|
+
- lib/jimmy_jukebox/songs/BudPowell.yml
|
160
162
|
- lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
|
161
163
|
- lib/jimmy_jukebox/songs/DizzyGillespie.yml
|
162
164
|
- lib/jimmy_jukebox/songs/DukeEllington.yml
|
@@ -170,9 +172,11 @@ files:
|
|
170
172
|
- lib/jimmy_jukebox/songs/Vivaldi.yml
|
171
173
|
- lib/jimmy_jukebox/songs/Beethoven.yml
|
172
174
|
- lib/jimmy_jukebox/songs/JamesPJohnson.yml
|
175
|
+
- lib/jimmy_jukebox/songs/CecilTaylor.yml
|
173
176
|
- lib/jimmy_jukebox/songs/JellyRollMorton.yml
|
174
177
|
- lib/jimmy_jukebox/songs/Chopin.yml
|
175
178
|
- lib/jimmy_jukebox/songs/Ragtime.yml
|
179
|
+
- lib/jimmy_jukebox/songs/Monk.yml
|
176
180
|
- lib/jimmy_jukebox/songs/EarlHines.yml
|
177
181
|
- spec/jimmy_jukebox_spec.rb
|
178
182
|
- spec/song_loader_spec.rb
|