ektoplayer 0.1.12 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ektoplayer/application.rb +49 -19
  3. data/lib/ektoplayer/bindings.rb +91 -87
  4. data/lib/ektoplayer/browsepage.rb +14 -27
  5. data/lib/ektoplayer/common.rb +12 -67
  6. data/lib/ektoplayer/compat.rb +5 -11
  7. data/lib/ektoplayer/config.rb +52 -17
  8. data/lib/ektoplayer/controllers/browser.rb +10 -5
  9. data/lib/ektoplayer/database.rb +7 -20
  10. data/lib/ektoplayer/download/externaldownload.rb +65 -0
  11. data/lib/ektoplayer/download/rubydownload.rb +69 -0
  12. data/lib/ektoplayer/icurses/curses.rb +18 -2
  13. data/lib/ektoplayer/icurses/{ffi_ncurses.rb → ffi-ncurses.rb} +1 -0
  14. data/lib/ektoplayer/icurses/ncurses.rb +10 -0
  15. data/lib/ektoplayer/icurses.rb +13 -5
  16. data/lib/ektoplayer/models/browser.rb +11 -11
  17. data/lib/ektoplayer/models/player.rb +4 -5
  18. data/lib/ektoplayer/operations/browser.rb +9 -1
  19. data/lib/ektoplayer/operations/playlist.rb +1 -1
  20. data/lib/ektoplayer/players/mpg_wrapper_player.rb +98 -40
  21. data/lib/ektoplayer/theme.rb +78 -63
  22. data/lib/ektoplayer/trackloader.rb +25 -74
  23. data/lib/ektoplayer/ui/colors.rb +33 -5
  24. data/lib/ektoplayer/ui/widgets/container.rb +1 -1
  25. data/lib/ektoplayer/ui/widgets/listwidget.rb +35 -34
  26. data/lib/ektoplayer/ui/widgets.rb +19 -0
  27. data/lib/ektoplayer/ui.rb +22 -23
  28. data/lib/ektoplayer/updater.rb +3 -4
  29. data/lib/ektoplayer/views/browser.rb +7 -2
  30. data/lib/ektoplayer/views/help.rb +5 -2
  31. data/lib/ektoplayer/views/info.rb +22 -27
  32. data/lib/ektoplayer/views/playinginfo.rb +20 -19
  33. data/lib/ektoplayer/views/playlist.rb +8 -3
  34. data/lib/ektoplayer/views/progressbar.rb +26 -33
  35. data/lib/ektoplayer/views/splash.rb +14 -22
  36. data/lib/ektoplayer/views/trackrenderer.rb +14 -10
  37. metadata +7 -5
@@ -4,14 +4,12 @@ require_relative '../theme'
4
4
 
5
5
  module Ektoplayer
6
6
  module Views
7
- class ProgressBar < UI::Window
7
+ class ProgressBar < UI::Pad
8
8
  def layout
9
9
  super
10
- load_colors
11
- end
12
-
13
- def load_colors(force=false)
14
- return if @fade and not force
10
+ self.pad_size=(UI::Size.new(
11
+ height: 1, width: @size.width * 2
12
+ ))
15
13
 
16
14
  if Theme.current == 256
17
15
  fader = UI::ColorFader.new([25,26,27,32,39,38,44,44,45,51,87,159,195])
@@ -21,49 +19,44 @@ module Ektoplayer
21
19
  fader = UI::ColorFader.new([-1])
22
20
  end
23
21
 
24
- @fade = fader.fade(@size.width)
25
- @progress_width = @size.width
26
- @progress_char = Config[:'progressbar.progress_char']
27
- @rest_char = Config[:'progressbar.rest_char']
28
- end
22
+ progress_char = Config[:'progressbar.progress_char']
23
+
24
+ @win.move(0,0)
29
25
 
26
+ fader.fade(@size.width).each do |c|
27
+ @win.attron(c)
28
+ @win.addstr(progress_char)
29
+ end
30
+
31
+ @win.attron(Theme[:'progressbar.rest'])
32
+ @win << Config[:'progressbar.rest_char'] * @size.width
33
+ end
30
34
 
31
35
  def attach(player)
32
36
  player.events.on(:position_change) do
33
- self.percent_playing = player.position_percent
37
+ old = @progress_width
38
+ @progress_width = @size.width - (player.position_percent * @size.width).to_i rescue 0
39
+
40
+ if (old != @progress_width) and visible?
41
+ @pad_mincol = (@progress_width)
42
+ refresh
43
+ end
34
44
  end
35
45
 
36
46
  view=self # TODO
37
47
  [ICurses::BUTTON1_CLICKED, ICurses::BUTTON2_CLICKED, ICurses::BUTTON3_CLICKED].
38
48
  each do |button|
39
49
  view.mouse.on(button) do |mevent|
40
- pos = Float(mevent.x) / (self.size.width - 1) * player.length rescue player.position
50
+ x = mevent.x - @pad_mincol
51
+ pos = Float(x) / (self.size.width - 1) * player.length rescue player.position
41
52
  player.seek(pos.to_i)
53
+ @progress_width = x
54
+ self.pad_mincol=(@size.width - @progress_width)
42
55
  end
43
56
  end
44
57
  end
45
58
 
46
- def percent_playing=(percent_playing)
47
- char_width = (percent_playing * @size.width).to_i
48
- return if char_width == @progress_width
49
-
50
- with_lock do
51
- @progress_width = char_width
52
- want_redraw
53
- end
54
- end
55
-
56
59
  def draw
57
- load_colors
58
- @win.move(0,0)
59
-
60
- @progress_width.times do |i|
61
- @win.attron(@fade[i])
62
- @win << @progress_char
63
- end
64
-
65
- @win.attron(Theme[:'progressbar.rest'])
66
- @win << @rest_char * (@size.width - @win.curx)
67
60
  end
68
61
  end
69
62
  end
@@ -25,28 +25,20 @@ module Ektoplayer
25
25
  |___/\___/\_,_|_||_\__,_| |____|_|_.__/\___|_| \__,_|\__|_\___/_||_|}.
26
26
  split(?\n)[1..-1].freeze
27
27
 
28
- BUBBLES = [
29
- UI::Point.new(x: 6, y: 3).freeze, UI::Point.new(x: 6, y: 7).freeze,
30
- UI::Point.new(x: 28, y: 1).freeze, UI::Point.new(x: 28, y: 9).freeze,
31
- UI::Point.new(x: 46, y: 7).freeze, UI::Point.new(x: 71, y: 9).freeze
32
- ].freeze
28
+ BUBBLES = [[6,3], [6,7], [28,1], [28,9], [46,7], [71,9]].freeze
33
29
 
34
30
  def load_colors
35
- signature_fade = ekto_logo_fade = bubble_fade = [-1].freeze
36
-
37
31
  if Theme.current == 256
38
- bubble_fade = [168,167,161,161,161].freeze
39
- signature_fade = [99, 105, 111, 117].freeze
40
- ekto_logo_fade = [23, 23, 29, 36, 42, 48, 42, 36, 29, 23].freeze
32
+ @bubble_fade = UI::ColorFader.new([168,167,161,161,161])
33
+ @signature_fade = UI::ColorFader.new([99, 105, 111, 117])
34
+ @ekto_logo_fade = UI::ColorFader.new([23, 23, 29, 36, 42, 48, 42, 36, 29, 23])
41
35
  elsif Theme.current == 8
42
- bubble_fade = [:red].freeze
43
- ekto_logo_fade = [:blue].freeze
44
- signature_fade = [:magenta].freeze
36
+ @bubble_fade = UI::ColorFader.new([:red])
37
+ @ekto_logo_fade = UI::ColorFader.new([:blue])
38
+ @signature_fade = UI::ColorFader.new([:magenta])
39
+ else
40
+ @bubble_fade = @signature_fade = @ekto_logo_fade = UI::ColorFader.new([-1])
45
41
  end
46
-
47
- @bubble_fade = UI::ColorFader.new(bubble_fade)
48
- @signature_fade = UI::ColorFader.new(signature_fade)
49
- @ekto_logo_fade = UI::ColorFader.new(ekto_logo_fade)
50
42
  end
51
43
 
52
44
  def draw
@@ -73,11 +65,11 @@ module Ektoplayer
73
65
  end
74
66
 
75
67
  f = @bubble_fade.fade(EKTOPLAZM_LOGO.size)
76
- BUBBLES.each do |p|
77
- @win.attrset(f[p.y - 1])
78
- @win.mvaddstr(top_pad + p.y - 1, left_pad + p.x + 1, ?_)
79
- @win.attrset(f[p.y])
80
- @win.mvaddstr(top_pad + p.y, left_pad + p.x, '(_)')
68
+ BUBBLES.each do |x,y|
69
+ @win.attrset(f[y - 1])
70
+ @win.mvaddstr(top_pad + y - 1, left_pad + x + 1, ?_)
71
+ @win.attrset(f[y])
72
+ @win.mvaddstr(top_pad + y, left_pad + x, '(_)')
81
73
  end
82
74
 
83
75
  return unless draw_signature
@@ -98,7 +98,7 @@ module Ektoplayer
98
98
  additional_attributes |= ICurses::A_BOLD if marked
99
99
  additional_attributes |= ICurses::A_STANDOUT if selected
100
100
 
101
- if item.is_a? String or item.is_a? Symbol
101
+ if item.is_a? String or item.is_a? Symbol or item.is_a? Integer
102
102
  if selection
103
103
  color = Theme[:'list.item_selection']
104
104
  elsif index % 2 == 0
@@ -112,9 +112,10 @@ module Ektoplayer
112
112
  return
113
113
  end
114
114
 
115
- @column_format.each_with_index do |c,i|
116
- scr.addch(32) if i > 0
115
+ left_pad = 0
116
+ y = scr.cury
117
117
 
118
+ @column_format.each_with_index do |c,i|
118
119
  if selection
119
120
  scr.attrset(Theme[:'list.item_selection'] | additional_attributes)
120
121
  else
@@ -122,22 +123,25 @@ module Ektoplayer
122
123
  end
123
124
 
124
125
  if value = item[c[:tag]]
125
- if value.is_a?(Integer)
126
- value = "%.2d" % value
126
+ if value.is_a? Integer
127
+ value = '%.2d' % value
127
128
  else
128
129
  value = value.to_s[0..(c[:render_size] - 1)]
129
130
  end
130
131
 
132
+ scr.mvaddstr(y, left_pad, ' ' * c[:render_size])
133
+ scr.addch(32) if i < @column_format.size - 1
134
+
131
135
  if c[:justify] == :right
132
- scr.addstr(value.rjust(c[:render_size]))
136
+ scr.mvaddstr(y, left_pad, value.rjust(c[:render_size]))
133
137
  else
134
- scr.addstr(value.ljust(c[:render_size]))
138
+ scr.mvaddstr(y, left_pad, value)
135
139
  end
136
- else
137
- scr.addstr(' ' * c[:render_size])
138
140
  end
141
+
142
+ left_pad += c[:render_size] + 1
139
143
  end
140
144
  end
141
- end
145
+ end
142
146
  end
143
147
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ektoplayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Abendroth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-25 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -64,10 +64,12 @@ files:
64
64
  - lib/ektoplayer/controllers/mainwindow.rb
65
65
  - lib/ektoplayer/controllers/playlist.rb
66
66
  - lib/ektoplayer/database.rb
67
+ - lib/ektoplayer/download/externaldownload.rb
68
+ - lib/ektoplayer/download/rubydownload.rb
67
69
  - lib/ektoplayer/events.rb
68
70
  - lib/ektoplayer/icurses.rb
69
71
  - lib/ektoplayer/icurses/curses.rb
70
- - lib/ektoplayer/icurses/ffi_ncurses.rb
72
+ - lib/ektoplayer/icurses/ffi-ncurses.rb
71
73
  - lib/ektoplayer/icurses/ncurses.rb
72
74
  - lib/ektoplayer/icurses/ncursesw.rb
73
75
  - lib/ektoplayer/icurses/sugar.rb
@@ -123,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  - !ruby/object:Gem::Version
124
126
  version: '0'
125
127
  requirements:
126
- - 'For playback: /bin/mpg123 or the "audite-lib" gem'
127
- - 'For archive extracting: /bin/unzip, /bin/7z or the "rubyzip" gem'
128
+ - 'Playback: /bin/mpg123 or the "audite-lib" gem'
129
+ - 'Archive unpacking: /bin/unzip, /bin/7z or the "rubyzip" gem'
128
130
  - 'One of these curses-gems: ffi-ncurses, ncurses, ncursesw, curses'
129
131
  rubyforge_project:
130
132
  rubygems_version: 2.6.8