radiodan 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiodan (0.0.3)
4
+ radiodan (0.0.4)
5
5
  active_support (~> 3.0.0)
6
6
  em-http-request (~> 1.0.3)
7
7
  em-simple_telnet (~> 0.0.6)
@@ -15,7 +15,7 @@ GEM
15
15
  active_support (3.0.0)
16
16
  activesupport (= 3.0.0)
17
17
  activesupport (3.0.0)
18
- addressable (2.3.4)
18
+ addressable (2.3.5)
19
19
  coderay (1.0.9)
20
20
  cookiejar (0.3.0)
21
21
  diff-lcs (1.2.4)
@@ -27,7 +27,7 @@ GEM
27
27
  http_parser.rb (>= 0.5.3)
28
28
  em-simple_telnet (0.0.9)
29
29
  eventmachine (>= 1.0.0)
30
- em-socksify (0.2.1)
30
+ em-socksify (0.3.0)
31
31
  eventmachine (>= 1.0.0.beta.4)
32
32
  em-synchrony (1.0.3)
33
33
  eventmachine (>= 1.0.0.beta.1)
data/TODO CHANGED
@@ -1,17 +1,10 @@
1
1
  * Player
2
- - explicitly set playlist when a new event is triggered, don't attempt to sync
3
- - #sync reads playlist_sync methods
4
- + #errors to determine which events to trigger
5
- + Know when to restart playlists that repeat
6
- + Resume playlists from last position
2
+ - #sync determines which events to trigger under which circumstances
3
+ - Set random / repeat flags in MPD
4
+ - Resume playlists from last position / seek point
5
+ * Search for music in library, return playlist / array of tracks
7
6
  * MPD Adapter
8
7
  - Figure out a way of testing interface with playlist object
9
- * PlaylistSync
10
- - Attributes to sync:
11
- + Position in playlist
12
- + Seek position for current item in playlist
13
- - Differentiate when a playlist
14
- + is new (make this match exactly)
15
- + is not (keep in bounds of acceptability)
16
8
  * Panic Mode
17
9
  - Add tests
10
+ * Remove eventmachine?
@@ -33,7 +33,7 @@ class MPD
33
33
 
34
34
  # register new playlist events
35
35
  @player.register_event :playlist do |playlist|
36
- EM.next_tick { self.playlist = playlist }
36
+ self.playlist = playlist
37
37
  end
38
38
  end
39
39
 
@@ -24,8 +24,7 @@ module PlaylistParser
24
24
  end
25
25
 
26
26
  def self.parse_tracks(tracks)
27
- p tracks.first.inspect
28
- tracks.collect{ |t| Track.new(t) }
27
+ tracks.collect{ |t| Track.new(t) } rescue []
29
28
  end
30
29
 
31
30
  def self.parse_mode(attributes)
@@ -1,5 +1,6 @@
1
1
  require 'active_support'
2
2
  require 'active_support/core_ext/string'
3
+ require 'pathname'
3
4
 
4
5
  require 'logging'
5
6
  require 'player'
@@ -45,7 +46,7 @@ class Builder
45
46
  klass_path ||= false
46
47
  raise if klass_path
47
48
 
48
- # attempt to require from middleware
49
+ # attempt to require from given path
49
50
  klass_path = Pathname.new(File.join(File.dirname(__FILE__), klass_type, "#{klass.underscore}.rb"))
50
51
  require klass_path if klass_path.exist?
51
52
 
@@ -17,7 +17,7 @@ module EventBinding
17
17
  end
18
18
 
19
19
  bindings.each do |blk|
20
- blk.call(data)
20
+ EM.next_tick { blk.call(data) }
21
21
  end
22
22
  end
23
23
 
@@ -27,12 +27,15 @@ class Panic
27
27
 
28
28
  original_state = @player.playlist
29
29
 
30
- Thread.new do
31
- logger.debug "panic for #{@timeout} seconds"
32
- @player.playlist = @playlist
33
- sleep(@timeout)
34
- return_to_state original_state
35
- end
30
+ EM.defer \
31
+ proc {
32
+ logger.debug "panic for #{@timeout} seconds"
33
+ @player.playlist = @playlist
34
+ sleep(@timeout)
35
+ },
36
+ proc {
37
+ return_to_state original_state
38
+ }
36
39
 
37
40
  @panic
38
41
  end
@@ -1,13 +1,16 @@
1
+ require 'forwardable'
1
2
  require 'logging'
2
3
  require 'event_binding'
3
4
  require 'playlist_sync'
4
5
 
5
6
  class Radiodan
6
7
  class Player
8
+ extend Forwardable
7
9
  include Logging
8
10
  include EventBinding
9
11
 
10
12
  attr_reader :adapter, :playlist
13
+ def_delegators :adapter, :stop
11
14
 
12
15
  def adapter=(adapter)
13
16
  @adapter = adapter
@@ -1,3 +1,3 @@
1
1
  class Radiodan
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiodan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.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-06-29 00:00:00.000000000 Z
12
+ date: 2013-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -228,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  segments:
230
230
  - 0
231
- hash: 1823780625906972507
231
+ hash: -580184109337175163
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  none: false
234
234
  requirements:
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  segments:
239
239
  - 0
240
- hash: 1823780625906972507
240
+ hash: -580184109337175163
241
241
  requirements: []
242
242
  rubyforge_project:
243
243
  rubygems_version: 1.8.23