playa 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 913d76574de3fa2c25f99ac58d03e30cf8c792d2
4
- data.tar.gz: 906ce4a9acb9f163008d234fae9a23ad98fea0c0
3
+ metadata.gz: 4e33baff6fbf21a8320be1bdbe56eda3449c5924
4
+ data.tar.gz: 5282c77482a2a00d5bd78266aae920cc04e98354
5
5
  SHA512:
6
- metadata.gz: 9399dc3fc05c8c3e015dabeb625d1be5ef8c3b80df97572084bca323cbedb83b2029e3f3e264a28573d15bfde05bf47564960c6d95d567f4ba3cc22d51e10c71
7
- data.tar.gz: 44763a0dfed2dad5c9a97c890e7251104f8946944903f66f97576201b5237fb93f77aeefc3bc298c3e80b902fccd951c23c9a98a650f6c9dd40c48f926792e6f
6
+ metadata.gz: f5891878f72df393c7d047adae11057797f10c9d7f82198a2ed3a07bb6454df965e5fe34230e8abb5856dda78085cb7f93e1612472a24497d6a88d1d0f641016
7
+ data.tar.gz: 0183b6a9797e3293baf9674cf7405778b14bc6df0dbe620990c7cfebd2b19c56299b212a91ec4f077df1539bba75b1dc99166f15b27a066f22665e35768b574a
@@ -1,6 +1,6 @@
1
- require 'playa/playlist_view'
2
- require 'playa/progress_view'
3
- require 'playa/status_view'
1
+ require 'playa/views/playlist_view'
2
+ require 'playa/views/progress_view'
3
+ require 'playa/views/status_view'
4
4
 
5
5
  module Playa
6
6
  class Controller
@@ -0,0 +1,33 @@
1
+ require 'playa/view'
2
+
3
+ module Playa
4
+ class PlaylistView < View
5
+ include Vedeu
6
+
7
+ private
8
+
9
+ def type
10
+ :dsl
11
+ end
12
+
13
+ def output
14
+ view 'playlist' do
15
+ self.object.view.each do |sel, cur, item|
16
+ if sel && cur
17
+ line { text "\u{25B6}> #{item.title}" }
18
+
19
+ elsif cur
20
+ line { text " > #{item.title}" }
21
+
22
+ elsif sel
23
+ line { text "\u{25B6} #{item.title}" }
24
+
25
+ else
26
+ line { text " #{item.title}" }
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,78 @@
1
+ require 'playa/view'
2
+
3
+ module Playa
4
+ class ProgressView < View
5
+ include Vedeu
6
+
7
+ private
8
+
9
+ def type
10
+ :dsl
11
+ end
12
+
13
+ def output
14
+ if object.track
15
+ track_loaded
16
+
17
+ else
18
+ no_track_loaded
19
+
20
+ end
21
+ end
22
+
23
+ def track_loaded
24
+ view 'progress' do
25
+ line do
26
+ stream do
27
+ width progress_width
28
+ text progress_bar
29
+ end
30
+
31
+ stream do
32
+ width timer_width
33
+ text timer
34
+ align :right
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ def no_track_loaded
41
+ view 'progress' do
42
+ line do
43
+ stream do
44
+ width view_width
45
+ text ' '
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ def progress_width
52
+ view_width - timer_width - 1
53
+ end
54
+
55
+ def progress_bar
56
+ "\u{25FC}" * (object.progress * progress_width).ceil
57
+ end
58
+
59
+ def timer_width
60
+ timer.size + 1
61
+ end
62
+
63
+ def timer
64
+ remaining = (object.track.duration - object.counter).floor
65
+ mm, ss = remaining.divmod(60)
66
+ hh, mm = mm.divmod(60)
67
+ mins = mm.to_s.rjust(2, '0')
68
+ secs = ss.to_s.rjust(2, '0')
69
+
70
+ [mins, secs].join(":")
71
+ end
72
+
73
+ # TODO: playa knows too much here...
74
+ def view_width
75
+ @_width ||= Vedeu.with('progress').geometry.width
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,64 @@
1
+ require 'playa/view'
2
+
3
+ module Playa
4
+ class StatusView < View
5
+ include Vedeu
6
+
7
+ private
8
+
9
+ def type
10
+ :dsl
11
+ end
12
+
13
+ def output
14
+ view 'status' do
15
+ line do
16
+ stream do
17
+ colour foreground: '#ff0000'
18
+ text "\u{25B2}"
19
+ end
20
+ stream do
21
+ colour foreground: '#ffffff'
22
+ text ' Prev '
23
+ end
24
+
25
+ stream do
26
+ colour foreground: '#ff0000'
27
+ text "\u{25BC}"
28
+ end
29
+ stream do
30
+ colour foreground: '#ffffff'
31
+ text ' Next '
32
+ end
33
+
34
+ stream do
35
+ colour foreground: '#ff0000'
36
+ text "\u{21B2}"
37
+ end
38
+ stream do
39
+ colour foreground: '#ffffff'
40
+ text ' Select '
41
+ end
42
+
43
+ stream do
44
+ colour foreground: '#ff0000'
45
+ text "\u{2395}"
46
+ end
47
+ stream do
48
+ colour foreground: '#ffffff'
49
+ text ' Pause '
50
+ end
51
+
52
+ stream do
53
+ colour foreground: '#ff0000'
54
+ text "Q"
55
+ end
56
+ stream do
57
+ colour foreground: '#ffffff'
58
+ text ' Quit '
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
data/lib/playa.rb CHANGED
@@ -20,14 +20,14 @@ module Playa
20
20
  end
21
21
 
22
22
  interface 'progress' do
23
- colour foreground: '#afd700', background: '#005a00'
23
+ colour foreground: '#005aff', background: '#000000'
24
24
  cursor false
25
25
  width 60
26
26
  height 1
27
27
  y playlist.geometry.top - 2
28
28
  x playlist.geometry.left
29
29
  centred false
30
- delay 0.5
30
+ delay 1.0
31
31
  end
32
32
 
33
33
  interface 'status' do
data/playa.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'playa'
7
- spec.version = '0.0.9'
7
+ spec.version = '0.0.10'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = 'Plays mp3s from a directory.'
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- require 'playa/playlist_view'
2
+ require 'playa/views/playlist_view'
3
3
 
4
4
  module Playa
5
5
  describe PlaylistView do
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- require 'playa/progress_view'
2
+ require 'playa/views/progress_view'
3
3
 
4
4
  module Playa
5
5
  describe ProgressView do
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- require 'playa/status_view'
2
+ require 'playa/views/status_view'
3
3
 
4
4
  module Playa
5
5
  describe StatusView do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -197,25 +197,22 @@ files:
197
197
  - lib/playa.rb
198
198
  - lib/playa/controller.rb
199
199
  - lib/playa/player.rb
200
- - lib/playa/playlist_view.rb
201
- - lib/playa/progress_view.rb
202
- - lib/playa/status_view.rb
203
200
  - lib/playa/track.rb
204
201
  - lib/playa/track_collection.rb
205
202
  - lib/playa/view.rb
206
- - lib/playa/views/playlist.erb
207
- - lib/playa/views/status.erb
208
- - lib/playa/views/status_copy.erb
203
+ - lib/playa/views/playlist_view.rb
204
+ - lib/playa/views/progress_view.rb
205
+ - lib/playa/views/status_view.rb
209
206
  - playa.gemspec
210
207
  - screenshot.png
211
208
  - test/lib/playa/controller_test.rb
212
209
  - test/lib/playa/player_test.rb
213
- - test/lib/playa/playlist_view.rb
214
- - test/lib/playa/progress_view_test.rb
215
- - test/lib/playa/status_view_test.rb
216
210
  - test/lib/playa/track_collection_test.rb
217
211
  - test/lib/playa/track_test.rb
218
212
  - test/lib/playa/view_test.rb
213
+ - test/lib/playa/views/playlist_view_test.rb
214
+ - test/lib/playa/views/progress_view_test.rb
215
+ - test/lib/playa/views/status_view_test.rb
219
216
  - test/lib/playa_test.rb
220
217
  - test/support/parkwalk.mp3
221
218
  - test/test_helper.rb
@@ -246,12 +243,12 @@ summary: Plays mp3s from a directory.
246
243
  test_files:
247
244
  - test/lib/playa/controller_test.rb
248
245
  - test/lib/playa/player_test.rb
249
- - test/lib/playa/playlist_view.rb
250
- - test/lib/playa/progress_view_test.rb
251
- - test/lib/playa/status_view_test.rb
252
246
  - test/lib/playa/track_collection_test.rb
253
247
  - test/lib/playa/track_test.rb
254
248
  - test/lib/playa/view_test.rb
249
+ - test/lib/playa/views/playlist_view_test.rb
250
+ - test/lib/playa/views/progress_view_test.rb
251
+ - test/lib/playa/views/status_view_test.rb
255
252
  - test/lib/playa_test.rb
256
253
  - test/support/parkwalk.mp3
257
254
  - test/test_helper.rb
@@ -1,19 +0,0 @@
1
- require 'playa/view'
2
-
3
- module Playa
4
- class PlaylistView < View
5
- private
6
-
7
- def output
8
- [ 'playlist', playlist ]
9
- end
10
-
11
- def type
12
- :menu
13
- end
14
-
15
- def playlist
16
- object.view.map { |sel, cur, item| [ sel, cur, item.title ] }
17
- end
18
- end
19
- end
@@ -1,49 +0,0 @@
1
- require 'playa/view'
2
-
3
- module Playa
4
- class ProgressView < View
5
- private
6
-
7
- def output
8
- { 'progress' => [ progress ] }
9
- end
10
-
11
- def type
12
- :raw
13
- end
14
-
15
- def progress
16
- if object.track
17
- remaining = (object.track.duration - object.counter).floor
18
- mm, ss = remaining.divmod(60)
19
- hh, mm = mm.divmod(60)
20
- mins = mm.to_s.rjust(2, '0')
21
- secs = ss.to_s.rjust(2, '0')
22
- time = [mins, secs].join(":")
23
- pwidth = view_width - time.size - 1
24
- pbar = '|' * (object.progress * pwidth).ceil
25
-
26
- {
27
- streams: [
28
- {
29
- text: pbar,
30
- width: pwidth,
31
- align: :left
32
- }, {
33
- text: time,
34
- width: time.size + 1,
35
- align: :right
36
- }
37
- ]
38
- }
39
- else
40
- { streams: [{ text: ' ', width: view_width }] }
41
- end
42
- end
43
-
44
- # TODO: playa knows too much here...
45
- def view_width
46
- @_width ||= Vedeu.with('progress').geometry.width
47
- end
48
- end
49
- end
@@ -1,31 +0,0 @@
1
- require 'playa/view'
2
-
3
- module Playa
4
- class StatusView < View
5
- # def interface
6
- # 'status'
7
- # end
8
-
9
- # def path
10
- # File.expand_path('../views/status.erb', __FILE__)
11
- # end
12
-
13
- private
14
-
15
- # def output
16
- # self
17
- # end
18
-
19
- def output
20
- { 'status' => status }
21
- end
22
-
23
- def type
24
- :raw
25
- end
26
-
27
- def status
28
- [ "\u{25B2} Prev \u{25BC} Next \u{21B2} Select \u{2395} Pause Q Quit" ]
29
- end
30
- end
31
- end
File without changes
@@ -1 +0,0 @@
1
- <%= foreground('#ffff00') { "\u{25B2}" } -%> Prev <%= foreground('#ffff00') { "\u{25BC}" } -%> Next <%= foreground('#ffff00') { "\u{21B2}" } -%> Select <%= foreground('#ffff00') { "\u{2395}" } -%> Pause <%= foreground('#ffff00') { "Q" } -%> Quit
@@ -1,7 +0,0 @@
1
- <%- line do -%>
2
- <%= foreground('#ffff00') { "\u{25B2}" } -%> Prev
3
- <%= foreground('#ffff00') { "\u{25BC}" } -%> Next
4
- <%= foreground('#ffff00') { "\u{21B2}" } -%> Select
5
- <%= foreground('#ffff00') { "\u{2395}" } -%> Pause
6
- <%= foreground('#ffff00') { "Q" } -%> Quit
7
- <%- end -%>