jimmy_jukebox 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ module Artists
9
9
  bb: { genre: 'JAZZ', name: "bix_beiderbecke"},
10
10
  bm: { genre: 'JAZZ', name: "bennie_moten"},
11
11
  fc: { genre: 'CLASSICAL', name: "chopin"},
12
+ ca: { genre: 'JAZZ', name: "cannonball_adderley"},
12
13
  cc: { genre: 'JAZZ', name: "charlie_christian"},
13
14
  cp: { genre: 'JAZZ', name: "charlie_parker"},
14
15
  ch: { genre: 'JAZZ', name: "coleman_hawkins"},
@@ -22,6 +23,7 @@ module Artists
22
23
  fh: { genre: 'JAZZ', name: "fletcher_henderson"},
23
24
  h: { genre: 'CLASSICAL', name: 'haydn'},
24
25
  jj: { genre: 'JAZZ', name: "james_p_johnson"},
26
+ jm: { genre: 'JAZZ', name: "jazz_medleys"},
25
27
  jrm: { genre: 'JAZZ', name: "jelly_roll_morton"},
26
28
  jsb: { genre: 'CLASSICAL', name: "bach"},
27
29
  ko: { genre: 'JAZZ', name: "king_oliver"},
@@ -2,19 +2,38 @@ require 'jimmy_jukebox/user_config'
2
2
 
3
3
  module JimmyJukebox
4
4
 
5
- RUNNING_JRUBY = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || RUBY_PLATFORM == 'java'
6
-
7
5
  class Jukebox
8
6
 
9
7
  class NoSongsException < Exception; end
10
8
  class NoNewSongException < Exception; end
11
9
  class NoCurrentSongException < Exception; end
12
10
  class NoPreviousSongException < Exception; end
11
+ class NotRunningXWindowsException < Exception; end
13
12
 
14
- attr_accessor :current_song, :continuous_play, :songs_played
13
+ attr_accessor :current_song, :continuous_play, :songs_played, :initial_dpms_state
15
14
  attr_writer :user_config, :next_song, :playing
16
15
 
16
+ def dpms_state
17
+ raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
18
+ xsettings = `xset q`
19
+ xsettings.match(/DPMS is (.*)/)[1]
20
+ end
21
+
22
+ def restore_dpms_state
23
+ raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
24
+ puts "*** Restoring DPMS state to 'Enabled' ***"
25
+ `xset +dpms` if initial_dpms_state == 'Enabled'
26
+ end
27
+
28
+ def disable_monitor_powerdown
29
+ raise NotRunningXWindowsException unless JimmyJukebox::RUNNING_X_WINDOWS
30
+ self.initial_dpms_state = dpms_state
31
+ puts "*** Disabling DPMS. Will re-enable DPMS on shutdown ***" if initial_dpms_state == 'Enabled'
32
+ `xset -dpms` #`; xset s off`
33
+ end
34
+
17
35
  def initialize(new_user_config = UserConfig.new, continuous_play = true)
36
+ disable_monitor_powerdown if JimmyJukebox::RUNNING_X_WINDOWS
18
37
  self.user_config = new_user_config
19
38
  self.continuous_play = continuous_play
20
39
  raise NoSongsException if songs.empty?
@@ -0,0 +1,8 @@
1
+ ---
2
+ - http://archive.org/download/SomethinElse/01-AutumnLeaves10.59.mp3
3
+ - http://archive.org/download/SomethinElse/02-LoveForSale7.06.mp3
4
+ - http://archive.org/download/SomethinElse/03-SomethinElse8.14.mp3
5
+ - http://archive.org/download/SomethinElse/04-OneForDaddy-o8.25.mp3
6
+ - http://archive.org/download/SomethinElse/05-DancingInTheDark4.07.mp3
7
+ - http://archive.org/download/SomethinElse/06-AlisonsUncle5.04.mp3
8
+ - http://archive.org/download/BlueInGreen/03-BlueInGreen.mp3
@@ -0,0 +1,14 @@
1
+ ---
2
+ - http://archive.org/download/Late1950sJazzSaxophoneGreats/Late1950sSaxophoneGreats.mp3
3
+ - http://archive.org/download/1950sClassicJazzTrumpetGreats/1950sJazzTrumpetGreats.mp3
4
+ - http://archive.org/download/Early1960sJazzSaxophoneGreats/Early60sSaxGreats.mp3
5
+ - http://archive.org/download/HankMobley-HighVoltage/01.highVoltage.mp3
6
+ - http://archive.org/download/TheLastTimeISawParis/01-TheLastTimeISawParis.mp3
7
+ - http://archive.org/download/DexterGordon-Tanya/01-Tanya.mp3
8
+ - http://archive.org/download/DexterGordonQuintetWardellGray-TheChase1947/DexterGordonQuintetWardellGray-TheChase1947.mp3
9
+ - http://archive.org/download/PoolsideJazzPodcast1_0/pj1.mp3
10
+ - http://archive.org/download/PoolsideJazzPodcast2/pj2.mp3
11
+ - http://archive.org/download/PoolsideJazzPodcast3/pj3.mp3
12
+ - http://archive.org/download/PoolsideJazzPodcast4_2/pj4.mp3
13
+ - http://archive.org/download/PoolsideJazzPodcast5/pj5.mp3
14
+ - http://archive.org/download/PoolsideJazzPodcast6/pj6.mp3
@@ -5,6 +5,19 @@ include Artists
5
5
 
6
6
  module JimmyJukebox
7
7
 
8
+ def self.running_x_windows
9
+ xset_location = `which xset`
10
+ if xset_location
11
+ !!xset_location.match(/\/xset/)
12
+ else
13
+ false
14
+ end
15
+ end
16
+
17
+ RUNNING_JRUBY = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || RUBY_PLATFORM == 'java'
18
+ RUNNING_LINUX = RbConfig::CONFIG['host_os'] =~ /linux/i
19
+ RUNNING_X_WINDOWS = running_x_windows
20
+
8
21
  class UserConfig
9
22
 
10
23
  attr_writer :music_directories
@@ -1,6 +1,6 @@
1
1
  require 'io/console'
2
2
 
3
- if $running_jruby
3
+ if JimmyJukebox::RUNNING_JRUBY
4
4
  class IO
5
5
  def getch
6
6
  raw do
@@ -13,6 +13,7 @@ end
13
13
  jj = Jukebox.new
14
14
 
15
15
  play_loop_thread = Thread.new do
16
+ at_exit { jj.restore_dpms_state } if JimmyJukebox::RUNNING_LINUX
16
17
  jj.play_loop
17
18
  end
18
19
 
@@ -22,7 +23,7 @@ user_input_thread = Thread.new do
22
23
 
23
24
  begin
24
25
  loop do
25
- if $running_jruby
26
+ if JimmyJukebox::RUNNING_JRUBY
26
27
  char = STDIN.getch
27
28
  else
28
29
  begin
@@ -1,4 +1,4 @@
1
1
  module JimmyJukebox
2
- VERSION = '0.5.3'
3
- DATE = '2013-03-01'
2
+ VERSION = '0.5.4'
3
+ DATE = '2013-03-11'
4
4
  end
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.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -135,6 +135,7 @@ files:
135
135
  - lib/jimmy_jukebox/songs/BennieMoten.yml
136
136
  - lib/jimmy_jukebox/songs/FletcherHenderson.yml
137
137
  - lib/jimmy_jukebox/songs/ColemanHawkins.yml
138
+ - lib/jimmy_jukebox/songs/JazzMedleys.yml
138
139
  - lib/jimmy_jukebox/songs/KingOliver.yml
139
140
  - lib/jimmy_jukebox/songs/OriginalDixielandJazzBand.yml
140
141
  - lib/jimmy_jukebox/songs/OscarPeterson.yml
@@ -150,6 +151,7 @@ files:
150
151
  - lib/jimmy_jukebox/songs/MilesDavis.yml
151
152
  - lib/jimmy_jukebox/songs/BudPowell.yml
152
153
  - lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
154
+ - lib/jimmy_jukebox/songs/CannonballAdderley.yml
153
155
  - lib/jimmy_jukebox/songs/DizzyGillespie.yml
154
156
  - lib/jimmy_jukebox/songs/DukeEllington.yml
155
157
  - lib/jimmy_jukebox/songs/BennyGoodman.yml