jimmy_jukebox 0.4.7 → 0.5.0

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/bin/play_jukebox CHANGED
@@ -7,7 +7,7 @@ if $running_jruby
7
7
  require 'spoon'
8
8
  rescue LoadError => e
9
9
  if e.message =~ /spoon/
10
- p "*** You must run 'gem install spoon' before using JimmyJukebox on JRuby ***"
10
+ puts "*** You must run 'gem install spoon' before using JimmyJukebox on JRuby ***"
11
11
  exit
12
12
  else
13
13
  raise
@@ -18,7 +18,7 @@ else
18
18
  require 'posix/spawn'
19
19
  rescue LoadError => e
20
20
  if e.message =~ /posix/ || e.message =~ /spawn/
21
- p "*** You must run 'gem install posix-spawn' before using JimmyJukebox in Ruby ***"
21
+ puts "*** You must run 'gem install posix-spawn' before using JimmyJukebox in Ruby ***"
22
22
  exit
23
23
  else
24
24
  raise
@@ -23,7 +23,6 @@ module JimmyJukebox
23
23
  def play_loop
24
24
  loop do
25
25
  if continuous_play && !playing?
26
- p "Playing next song"
27
26
  play_next_song
28
27
  else
29
28
  sleep 0.1
@@ -67,7 +66,7 @@ module JimmyJukebox
67
66
  if previous_song && current_song
68
67
  enable_continuous_play
69
68
  self.next_song = previous_song
70
- p "Replaying #{previous_song.music_file}"
69
+ puts "Replaying #{previous_song.music_file}"
71
70
  current_song.terminate
72
71
  self.current_song = nil
73
72
  self.playing = false
@@ -81,7 +80,7 @@ module JimmyJukebox
81
80
  song_to_erase = current_song
82
81
  skip_song
83
82
  File.delete(song_to_erase.music_file)
84
- p "Erased #{song_to_erase.music_file}"
83
+ puts "Erased #{song_to_erase.music_file}"
85
84
  user_config.generate_song_list
86
85
  else
87
86
  raise NoCurrentSongException, "No current_song"
@@ -91,7 +90,7 @@ module JimmyJukebox
91
90
  def skip_song
92
91
  if current_song
93
92
  enable_continuous_play
94
- p "Skipping #{current_song.music_file}"
93
+ puts "Skipping #{current_song.music_file}"
95
94
  current_song.terminate
96
95
  self.current_song = nil
97
96
  self.playing = false
@@ -135,19 +134,19 @@ module JimmyJukebox
135
134
  self.current_song = song
136
135
  self.songs_played << song
137
136
  current_song.play(user_config, self)
138
- p "Finished playing"
139
- p '-------------------------------------'
137
+ puts "Finished playing"
140
138
  self.current_song = nil
141
139
  self.playing = false
142
140
  rescue Song::SongTerminatedPrematurelyException
143
- p "Song ended prematurely"
141
+ ensure
142
+ puts "-------------------------------------"
144
143
  end
145
144
 
146
145
  def terminate_current_song(opts=nil)
147
146
  # By default, stops song and lets a new song play automatically
148
147
  # To prevent another song from playing automatically, pass "play_another: false"
149
148
  if current_song
150
- p "Terminating #{current_song.music_file}"
149
+ puts "Terminating #{current_song.music_file}"
151
150
  current_song.terminate
152
151
  self.current_song = nil
153
152
  self.playing = (opts && opts[:play_another]) ? !play_another : false
@@ -72,7 +72,6 @@ module JimmyJukebox
72
72
  playpid = playing_pid
73
73
  if grandpid
74
74
  `kill #{grandpid}`
75
- p "killed #{grandpid}"
76
75
  end
77
76
  `kill #{playpid}`
78
77
  end
@@ -122,8 +121,8 @@ module JimmyJukebox
122
121
  end
123
122
 
124
123
  def play_with_player
125
- p "Now playing '#{music_file}'"
126
- p "Press Ctrl-C to stop the music and exit this program"
124
+ puts "Now playing '#{music_file}'"
125
+ puts "Press Ctrl-C to stop the music and exit this program"
127
126
  run_command(player, music_file)
128
127
  Process.waitpid(playing_pid) # Waits for a child process to exit, returns its process id, and sets $? to a Process::Status object
129
128
  $? # return Process::Status object with instance methods .stopped?, .exited?, .exitstatus
@@ -105,13 +105,13 @@ module JimmyJukebox
105
105
  def download_num_songs(song_urls, save_dir, max_num = nil)
106
106
  current_songs = all_subdir_music_files(save_dir)
107
107
  do_not_have = downloadable(song_urls, current_songs)
108
- p "You already have all songs for this artist" if do_not_have.empty?
108
+ puts "You already have all songs for this artist" if do_not_have.empty?
109
109
  if max_num
110
110
  more_songs = max_num - current_songs.length
111
111
  if more_songs > 0
112
112
  do_not_have = n_random_songs(do_not_have, more_songs)
113
113
  else
114
- p "You already have #{current_songs.length} songs by this artist and are requesting a maximum of #{max_num} songs"
114
+ puts "You already have #{current_songs.length} songs by this artist and are requesting a maximum of #{max_num} songs"
115
115
  do_not_have = []
116
116
  end
117
117
  end
@@ -130,7 +130,7 @@ module JimmyJukebox
130
130
 
131
131
  def song_already_exists?(savename, save_dir)
132
132
  if version_of_song_in_dir_or_subdir?(savename, save_dir)
133
- p "#{savename} already exists in #{save_dir}"
133
+ puts "#{savename} already exists in #{save_dir}"
134
134
  true
135
135
  else
136
136
  false
@@ -140,7 +140,7 @@ module JimmyJukebox
140
140
  def download_song(song_url, save_dir)
141
141
  savename = song_savename(song_url)
142
142
  return if song_already_exists?(savename, save_dir)
143
- p "Downloading #{savename} to #{save_dir}"
143
+ puts "Downloading #{savename} to #{save_dir}"
144
144
  song_pathname = File.join(save_dir, savename)
145
145
  open(song_pathname, 'wb') do |dst|
146
146
  open(song_url) do |src|
@@ -149,7 +149,7 @@ module JimmyJukebox
149
149
  end
150
150
  check_downloaded_song_size(song_pathname)
151
151
  rescue OpenURI::HTTPError
152
- p "Warning: Could not download #{song_url}"
152
+ puts "Warning: Could not download #{song_url}"
153
153
  File.delete(song_pathname) if File.exists?(song_pathname)
154
154
  nil
155
155
  end
@@ -19,7 +19,7 @@ end
19
19
  user_input_thread = Thread.new do
20
20
 
21
21
  def display_options
22
- p "'p' = (un)pause, 'q' = quit, 'r' = replay previous song, 's' = skip this song, 'e' = erase this song"
22
+ puts "'p' = (un)pause, 'q' = quit, 'r' = replay previous song, 's' = skip this song, 'e' = erase this song"
23
23
  end
24
24
 
25
25
  def display_options_after_delay
@@ -33,7 +33,7 @@ user_input_thread = Thread.new do
33
33
  begin
34
34
  loop do
35
35
  display_options_after_delay
36
- case STDIN.getch
36
+ case char = STDIN.getch
37
37
  when "q", "Q"
38
38
  raise Interrupt
39
39
  when "e", "E"
@@ -41,25 +41,21 @@ user_input_thread = Thread.new do
41
41
  when "p", "P"
42
42
  raise NoPlayLoopThreadException, "Can't find play_loop_thread" unless play_loop_thread
43
43
  if jj.current_song.paused?
44
- p "Unpause requested"
45
44
  jj.unpause_current_song
46
45
  else
47
- p "Pause requested"
48
- p "To unpause, enter 'p' again"
46
+ puts "Pausing. To unpause, enter 'p' again"
49
47
  jj.pause_current_song
50
48
  end
51
49
  when "r", "R"
52
- p "Replay previous song requested"
53
50
  jj.replay_previous_song
54
51
  when "s", "S"
55
- p "Skip song requested"
56
52
  jj.skip_song
57
53
  else
58
- p "#{line.strip} is not a valid response"
54
+ puts "#{char.strip} is not a valid response" if char
59
55
  end
60
56
  end
61
57
  rescue Interrupt, SystemExit => e
62
- p "JimmyJukebox closed by user request. Bye!"
58
+ puts "JimmyJukebox closed by user request. Bye!"
63
59
  jj.quit
64
60
  exit
65
61
  end
@@ -1,4 +1,4 @@
1
1
  module JimmyJukebox
2
- VERSION = '0.4.7'
3
- DATE = '2013-02-27'
2
+ VERSION = '0.5.0'
3
+ DATE = '2013-03-01'
4
4
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: jimmy_jukebox
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.7
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Lavin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -130,60 +130,57 @@ files:
130
130
  - roadmap.txt
131
131
  - LICENSE.txt
132
132
  - lib/jimmy_jukebox.rb
133
- - lib/jimmy_jukebox/version.rb
134
- - lib/jimmy_jukebox/artists.rb
135
- - lib/jimmy_jukebox/song.rb
136
- - lib/jimmy_jukebox/jukebox.rb
137
- - lib/jimmy_jukebox/user_config.rb
133
+ - lib/jimmy_jukebox/load_jukebox_code.rb
138
134
  - lib/jimmy_jukebox/user_interface.rb
135
+ - lib/jimmy_jukebox/user_config.rb
136
+ - lib/jimmy_jukebox/jukebox.rb
137
+ - lib/jimmy_jukebox/song.rb
138
+ - lib/jimmy_jukebox/version.rb
139
139
  - lib/jimmy_jukebox/song_loader.rb
140
- - lib/jimmy_jukebox/load_jukebox_code.rb
141
- - lib/jimmy_jukebox/songs/BillieHoliday.yml
142
- - lib/jimmy_jukebox/songs/CharlieParker.yml
140
+ - lib/jimmy_jukebox/artists.rb
141
+ - lib/jimmy_jukebox/songs/Mozart.yml
142
+ - lib/jimmy_jukebox/songs/JellyRollMorton.yml
143
+ - lib/jimmy_jukebox/songs/DizzyGillespie.yml
144
+ - lib/jimmy_jukebox/songs/SidneyBechet.yml
145
+ - lib/jimmy_jukebox/songs/Haydn.yml
143
146
  - lib/jimmy_jukebox/songs/FranzSchubert.yml
144
- - lib/jimmy_jukebox/songs/CharlieChristian.yml
145
- - lib/jimmy_jukebox/songs/BennieMoten.yml
147
+ - lib/jimmy_jukebox/songs/EarlHines.yml
148
+ - lib/jimmy_jukebox/songs/CharlieParker.yml
146
149
  - lib/jimmy_jukebox/songs/FletcherHenderson.yml
147
- - lib/jimmy_jukebox/songs/ColemanHawkins.yml
148
150
  - lib/jimmy_jukebox/songs/KingOliver.yml
149
- - lib/jimmy_jukebox/songs/OriginalDixielandJazzBand.yml
151
+ - lib/jimmy_jukebox/songs/DukeEllington.yml
152
+ - lib/jimmy_jukebox/songs/ArtTatum.yml
153
+ - lib/jimmy_jukebox/songs/BixBeiderbecke.yml
154
+ - lib/jimmy_jukebox/songs/BennyGoodman.yml
155
+ - lib/jimmy_jukebox/songs/ColemanHawkins.yml
150
156
  - lib/jimmy_jukebox/songs/OscarPeterson.yml
157
+ - lib/jimmy_jukebox/songs/OriginalDixielandJazzBand.yml
158
+ - lib/jimmy_jukebox/songs/DjangoReinhardt.yml
159
+ - lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
160
+ - lib/jimmy_jukebox/songs/Vivaldi.yml
161
+ - lib/jimmy_jukebox/songs/BillieHoliday.yml
162
+ - lib/jimmy_jukebox/songs/Beethoven.yml
163
+ - lib/jimmy_jukebox/songs/Ragtime.yml
164
+ - lib/jimmy_jukebox/songs/ArtieShaw.yml
151
165
  - lib/jimmy_jukebox/songs/Dixieland.yml
166
+ - lib/jimmy_jukebox/songs/MilesDavis.yml
167
+ - lib/jimmy_jukebox/songs/LionelHampton.yml
152
168
  - lib/jimmy_jukebox/songs/LouisArmstrong.yml
153
- - lib/jimmy_jukebox/songs/DjangoReinhardt.yml
169
+ - lib/jimmy_jukebox/songs/Bach.yml
170
+ - lib/jimmy_jukebox/songs/BennieMoten.yml
171
+ - lib/jimmy_jukebox/songs/CharlieChristian.yml
154
172
  - lib/jimmy_jukebox/songs/RedNorvo.yml
173
+ - lib/jimmy_jukebox/songs/Chopin.yml
155
174
  - lib/jimmy_jukebox/songs/Mendelssohn.yml
156
- - lib/jimmy_jukebox/songs/LionelHampton.yml
157
- - lib/jimmy_jukebox/songs/ArtTatum.yml
158
- - lib/jimmy_jukebox/songs/BixBeiderbecke.yml
159
- - lib/jimmy_jukebox/songs/ArtieShaw.yml
160
- - lib/jimmy_jukebox/songs/MilesDavis.yml
161
- - lib/jimmy_jukebox/songs/BudPowell.yml
162
- - lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
163
- - lib/jimmy_jukebox/songs/DizzyGillespie.yml
164
- - lib/jimmy_jukebox/songs/DukeEllington.yml
165
- - lib/jimmy_jukebox/songs/BennyGoodman.yml
166
175
  - lib/jimmy_jukebox/songs/CountBasie.yml
167
- - lib/jimmy_jukebox/songs/Bach.yml
168
176
  - lib/jimmy_jukebox/songs/ArchibaldCampBanjo.yml
169
- - lib/jimmy_jukebox/songs/Mozart.yml
170
- - lib/jimmy_jukebox/songs/Haydn.yml
171
- - lib/jimmy_jukebox/songs/SidneyBechet.yml
172
- - lib/jimmy_jukebox/songs/Vivaldi.yml
173
- - lib/jimmy_jukebox/songs/Beethoven.yml
174
177
  - lib/jimmy_jukebox/songs/JamesPJohnson.yml
175
- - lib/jimmy_jukebox/songs/CecilTaylor.yml
176
- - lib/jimmy_jukebox/songs/JellyRollMorton.yml
177
- - lib/jimmy_jukebox/songs/Chopin.yml
178
- - lib/jimmy_jukebox/songs/Ragtime.yml
179
- - lib/jimmy_jukebox/songs/Monk.yml
180
- - lib/jimmy_jukebox/songs/EarlHines.yml
181
- - spec/jimmy_jukebox_spec.rb
182
- - spec/song_loader_spec.rb
183
178
  - spec/user_config_spec.rb
184
179
  - spec/artists_spec.rb
185
180
  - spec/song_spec.rb
186
181
  - spec/spec_helper.rb
182
+ - spec/song_loader_spec.rb
183
+ - spec/jimmy_jukebox_spec.rb
187
184
  - bin/play_jukebox
188
185
  - bin/load_jukebox
189
186
  homepage: https://github.com/JamesLavin/jimmy_jukebox
@@ -213,9 +210,9 @@ signing_key:
213
210
  specification_version: 3
214
211
  summary: plays your MP3 & OGG files and lets you easily download music
215
212
  test_files:
216
- - spec/jimmy_jukebox_spec.rb
217
- - spec/song_loader_spec.rb
218
213
  - spec/user_config_spec.rb
219
214
  - spec/artists_spec.rb
220
215
  - spec/song_spec.rb
221
216
  - spec/spec_helper.rb
217
+ - spec/song_loader_spec.rb
218
+ - spec/jimmy_jukebox_spec.rb
@@ -1,3 +0,0 @@
1
- ---
2
- - http://archive.org/download/BudPowell-UnPocoLoco/14.Track14.mp3
3
- - http://archive.org/download/BudPowell-SomebodyLovesMe/BudPowell-SomebodyLovesMe.mp3
@@ -1,3 +0,0 @@
1
- ---
2
- - http://archive.org/download/CecilTaylor-Conquistador/01-Conquistador.mp3
3
- - http://archive.org/download/OtekiCaz27.05.2012/OtekiCaz20120527.
@@ -1,3 +0,0 @@
1
- ---
2
- - http://archive.org/download/JustAGigolo/TheloniousMonk-02-JustAGigolotake1.mp3
3
- -