ektoplayer 0.1.6 → 0.1.11

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/README.md +26 -12
  3. data/lib/ektoplayer/application.rb +6 -5
  4. data/lib/ektoplayer/bindings.rb +61 -55
  5. data/lib/ektoplayer/common.rb +19 -6
  6. data/lib/ektoplayer/compat.rb +3 -3
  7. data/lib/ektoplayer/config.rb +1 -11
  8. data/lib/ektoplayer/controllers/browser.rb +7 -5
  9. data/lib/ektoplayer/controllers/help.rb +1 -1
  10. data/lib/ektoplayer/controllers/info.rb +1 -1
  11. data/lib/ektoplayer/controllers/playlist.rb +24 -12
  12. data/lib/ektoplayer/icurses.rb +21 -0
  13. data/lib/ektoplayer/icurses/curses.rb +53 -0
  14. data/lib/ektoplayer/icurses/ffi_ncurses.rb +69 -0
  15. data/lib/ektoplayer/icurses/ncurses.rb +79 -0
  16. data/lib/ektoplayer/icurses/ncursesw.rb +1 -0
  17. data/lib/ektoplayer/icurses/sugar.rb +65 -0
  18. data/lib/ektoplayer/icurses/test.rb +99 -0
  19. data/lib/ektoplayer/models/player.rb +2 -2
  20. data/lib/ektoplayer/{mp3player.rb → players/mpg_portaudio_player.rb} +3 -3
  21. data/lib/ektoplayer/players/mpg_wrapper_player.rb +107 -0
  22. data/lib/ektoplayer/theme.rb +1 -6
  23. data/lib/ektoplayer/ui.rb +100 -129
  24. data/lib/ektoplayer/ui/colors.rb +14 -14
  25. data/lib/ektoplayer/ui/widgets.rb +4 -4
  26. data/lib/ektoplayer/ui/widgets/labelwidget.rb +1 -1
  27. data/lib/ektoplayer/ui/widgets/listwidget.rb +115 -46
  28. data/lib/ektoplayer/views/help.rb +7 -10
  29. data/lib/ektoplayer/views/info.rb +29 -38
  30. data/lib/ektoplayer/views/mainwindow.rb +2 -5
  31. data/lib/ektoplayer/views/playinginfo.rb +15 -20
  32. data/lib/ektoplayer/views/progressbar.rb +30 -10
  33. data/lib/ektoplayer/views/splash.rb +24 -25
  34. data/lib/ektoplayer/views/tabbar.rb +6 -5
  35. data/lib/ektoplayer/views/trackrenderer.rb +20 -14
  36. metadata +15 -47
  37. data/lib/ektoplayer/views/volumemeter.rb +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f582176b442c800e228430df528410b4da17417
4
- data.tar.gz: 79c3b9f12acb319956f5d47aa98ca00795ed73ca
3
+ metadata.gz: 54b54fea7b6eb4691e5c49ddddd3b9d46df9a591
4
+ data.tar.gz: 82b7a0d329781ac90e61671a7e89c5b3cf7002c3
5
5
  SHA512:
6
- metadata.gz: 1772fa75068b45cb11c0ae4dad2e060459eab414f05a93adf774ccb2451b1918c11a915c0d367369006dd66d9a2cf054ff9ac5e83463994ab7c0c9675e3816dd
7
- data.tar.gz: 06e9ac4671e584d4a647e3b88939c4154fa90719e05a6e0535728c535e760430430c44463aa0c4c93ffe2d778b2834ac3b455a388a2c03ee6af9b202282c4448
6
+ metadata.gz: 2015220c85d70a99d0c1c1fddc255781e19c1eba905a185371e1c465d08d4c31f1c300de772bd9cbf2ffc61683443a4cad3eda426ed6de91acc83ffc0b930806
7
+ data.tar.gz: a35820777f4373bd8587bd61fa56d66ed2b02483c49ee3ab2f671b4448cadb700ab7a8da4683d1f4874f101d18da58e1bc4dc9ec78d7dcd5ffb8e7a8282ebcd3
data/README.md CHANGED
@@ -6,7 +6,7 @@ It allows you to
6
6
  * Search for tracks by tags (artist, album, style, ...)
7
7
  * Play tracks located at ektoplazm.com
8
8
  * Display information about albums
9
- * Download a whole albums as mp3
9
+ * Download whole albums as mp3
10
10
 
11
11
  ## Features
12
12
 
@@ -26,29 +26,44 @@ It allows you to
26
26
  ## Requirements
27
27
 
28
28
  * Ruby (1.9)
29
- * Portaudio (19)
30
29
  * Mpg123 (1.14)
31
- * LibZip
32
30
  * Sqlite3
31
+ * One of the following ncurses gems: curses, ffi-ncurses, ncurses, ncuresw
33
32
 
34
- ## Installation
33
+ ## Optional Requirements
34
+
35
+ * For extracting album archives either `unzip`, `7z` or the Gem `RubyZip` is needed
35
36
 
36
- Assuming you have Ruby/Rubygems installed, you need portaudio and mpg123 as
37
- library to compile the native extensions.
37
+ ## Installation
38
38
 
39
39
  ### Arch Linux
40
40
 
41
- pacman -S ruby portaudio mpg123 sqlite3 ncurses zlib base-devel --needed
42
- gem install ektoplayer
41
+ * Using yaourt:
42
+ `yaourt -S ektoplayer`
43
+
44
+ * Using pacman:
45
+ `pacman -S ruby mpg123 sqlite3 ncurses --needed`
46
+ `gem install ektoplayer`
43
47
 
44
48
  ### Debian / Ubuntu (not yet tested)
45
49
 
46
- apt-get install ruby ruby-dev portaudio19-dev libmpg123-dev sqlite3 libsqlite3-dev libncurses-dev libz1g-dev build-essential
47
- gem install ektoplayer
50
+ `apt-get install ruby ruby-ncurses ruby-nokogiri ruby-sqlite3 mpg123 sqlite3 libncurses5`
51
+ `gem install ektoplayer`
48
52
 
49
53
  ## Configuration
50
54
 
51
- Have a look at the default [ektoplayer.rc](https://github.com/braph/ektoplayer/blob/master/doc/ektoplayer.rc).
55
+ Ektplayer keeps it's default configuration file under `~/.config/ektoplayer/ektoplayer.rc`.
56
+
57
+ Available configuration commands:
58
+ * `set <option> <value>`
59
+ * `bind <window> <key> <command>`
60
+ * `undbind <window> <key>`
61
+ * `unbind_all`
62
+ * `color <name> <fg> [<bg> [<attribute> ...]]`
63
+ * `color_mono <name> <fg> [<bg> [<attribute> ...]]`
64
+ * `color_256 <name> <fg> [<bg> [<attribute> ...]]`
65
+
66
+ See [ektoplayer.rc](https://github.com/braph/ektoplayer/blob/master/doc/ektoplayer.rc) for a configuration file with the default values.
52
67
 
53
68
  ## Authors
54
69
 
@@ -57,4 +72,3 @@ Have a look at the default [ektoplayer.rc](https://github.com/braph/ektoplayer/b
57
72
  ## See also
58
73
 
59
74
  * Ektoplayer was inspired by [Soundcloud2000](https://github.com/grobie/soundcloud2000) and [ncmpcpp](https://github.com/arybczak/ncmpcpp)
60
- * It uses [Audite](https://github.com/georgi/audite) as playback engine and [Nokogiri](http://www.nokogiri.org/) for parsing HTML
@@ -10,7 +10,7 @@ require 'date'
10
10
 
11
11
  module Ektoplayer
12
12
  class Application
13
- VERSION = '0.1.6'.freeze
13
+ VERSION = '0.1.11'.freeze
14
14
  GITHUB_URL = 'https://github.com/braph/ektoplayer'.freeze
15
15
  EKTOPLAZM_URL = 'http://www.ektoplazm.com'.freeze
16
16
 
@@ -35,7 +35,7 @@ module Ektoplayer
35
35
 
36
36
  def run
37
37
  #Thread.abort_on_exception=(true)
38
- Thread.report_on_exception=(true) if Thread.public_method_defined? :report_on_exception
38
+ Thread.report_on_exception=(true) if Thread.respond_to? :report_on_exception
39
39
 
40
40
  # make each configuration object globally accessible as a singleton
41
41
  [Config, Bindings, Theme].each { |c| Common::mksingleton(c) }
@@ -69,8 +69,10 @@ module Ektoplayer
69
69
  end
70
70
 
71
71
  UI::Canvas.run do
72
+ Application.log(self, 'running with ncurses interface:', $USING_CURSES)
73
+
72
74
  if Config[:use_colors] == :auto
73
- Theme.use_colors(ENV['TERM'] =~ /256/ ? 256 : 8)
75
+ Theme.use_colors(ICurses.colors >= 256 ? 256 : 8)
74
76
  else
75
77
  Theme.use_colors(Config[:use_colors])
76
78
  end
@@ -89,7 +91,7 @@ module Ektoplayer
89
91
  operations.register(:quit, &method(:exit))
90
92
  operations.register(:reload, &browser.method(:reload))
91
93
  operations.register(:update, &database.method(:update))
92
- operations.register(:refresh) { UI::Canvas.on_winch; UI::Canvas.update_screen(true) }
94
+ operations.register(:refresh) { UI::Canvas.update_screen(true, true) }
93
95
  Operations::Player.new(operations, player)
94
96
  Operations::Browser.new(operations, browser, playlist)
95
97
  Operations::Playlist.new(operations, playlist, player, trackloader)
@@ -110,7 +112,6 @@ module Ektoplayer
110
112
  Controllers::Help.new(main_w.help, view_ops)
111
113
  Controllers::Info.new(main_w.info, player, playlist, trackloader, database, view_ops)
112
114
  main_w.progressbar.attach(player)
113
- main_w.volumemeter.attach(player)
114
115
  main_w.playinginfo.attach(playlist, player)
115
116
 
116
117
  # ... events ...
@@ -1,5 +1,5 @@
1
1
  require 'set'
2
- require 'curses'
2
+ require_relative 'icurses'
3
3
 
4
4
  module Ektoplayer
5
5
  # Keybinding storage.
@@ -21,10 +21,10 @@ module Ektoplayer
21
21
  def initialize
22
22
  @commands = {}
23
23
 
24
- reg 'quit', 'Quit the program'
25
- reg 'refresh', 'Refresh the screen'
26
- reg 'reload', 'Apply database changes to browser'
27
- reg 'update', 'Start a database update'
24
+ reg 'quit', 'Quit the program'
25
+ reg 'refresh', 'Refresh the screen'
26
+ reg 'reload', 'Apply database changes to browser'
27
+ reg 'update', 'Start a database update'
28
28
 
29
29
  reg 'player.stop', 'Stop playing'
30
30
  reg 'player.toggle', 'Toggle play/pause'
@@ -40,7 +40,6 @@ module Ektoplayer
40
40
 
41
41
  reg 'playinginfo.toggle', 'Toggle playinginfo visibility'
42
42
  reg 'progressbar.toggle', 'Toggle progressbar visibility'
43
- reg 'volumemeter.toggle', 'Toggle volumemeter visibility'
44
43
  reg 'tabbar.toggle', 'Toggle tabbar visibility'
45
44
 
46
45
  reg 'playlist.goto_current', 'Go to current playing track'
@@ -64,7 +63,8 @@ module Ektoplayer
64
63
  end
65
64
 
66
65
  { search_up: 'Start search upwards', search_next: 'Goto next search result',
67
- search_down: 'Start search downwards', search_prev: 'Goto previous search result'
66
+ search_down: 'Start search downwards', search_prev: 'Goto previous search result',
67
+ toggle_selection: 'Toggle multi line selection',
68
68
  }.each do |cmd, desc|
69
69
  %w(browser playlist).each { |w| reg("#{w}.#{cmd}", desc) }
70
70
  end
@@ -75,22 +75,21 @@ module Ektoplayer
75
75
  :'playlist.show' => [?1 ],
76
76
  :'browser.show' => [?2 ],
77
77
  :'info.show' => [?3 ],
78
- :'help.show' => [?4, Curses::KEY_F1 ],
78
+ :'help.show' => [?4, ICurses::KEY_F1 ],
79
79
 
80
- :'playinginfo.toggle' => [?!, Curses::KEY_F2 ],
81
- :'progressbar.toggle' => [?%, Curses::KEY_F3 ],
82
- :'tabbar.toggle' => [?=, Curses::KEY_F4 ],
83
- :'volumemeter.toggle' => [?~, Curses::KEY_F5 ],
80
+ :'playinginfo.toggle' => [?!, ICurses::KEY_F2 ],
81
+ :'progressbar.toggle' => [?%, ICurses::KEY_F3 ],
82
+ :'tabbar.toggle' => [?=, ICurses::KEY_F4 ],
84
83
 
85
- :'player.forward' => [?f, Curses::KEY_RIGHT ],
86
- :'player.backward' => [?b, Curses::KEY_LEFT ],
84
+ :'player.forward' => [?f, ICurses::KEY_RIGHT ],
85
+ :'player.backward' => [?b, ICurses::KEY_LEFT ],
87
86
  :'player.stop' => [?s ],
88
87
  :'player.toggle' => [?p ],
89
88
 
90
89
  :'playlist.play_next' => [?> ],
91
90
  :'playlist.play_prev' => [?< ],
92
91
 
93
- :'tabs.next' => [?l, ?}, 9 ],
92
+ :'tabs.next' => [?l, ?}, '^i' ],
94
93
  :'tabs.prev' => [?h, ?{, 353 ],
95
94
 
96
95
  :quit => [?q ],
@@ -99,19 +98,21 @@ module Ektoplayer
99
98
  :update => [?U ]},
100
99
  playlist: {
101
100
  # movement
102
- :'playlist.top' => [?g, Curses::KEY_HOME ],
103
- :'playlist.bottom' => [?G, Curses::KEY_END ],
104
- :'playlist.up' => [?k, Curses::KEY_UP ],
105
- :'playlist.down' => [?j, Curses::KEY_DOWN ],
106
- :'playlist.page_down' => ['^d', Curses::KEY_NPAGE ],
107
- :'playlist.page_up' => ['^u', Curses::KEY_PPAGE ],
101
+ :'playlist.top' => [?g, ICurses::KEY_HOME ],
102
+ :'playlist.bottom' => [?G, ICurses::KEY_END ],
103
+ :'playlist.up' => [?k, ICurses::KEY_UP ],
104
+ :'playlist.down' => [?j, ICurses::KEY_DOWN ],
105
+ :'playlist.page_down' => ['^d', ICurses::KEY_NPAGE ],
106
+ :'playlist.page_up' => ['^u', ICurses::KEY_PPAGE ],
107
+ # selection
108
+ :'playlist.toggle_selection' => ['^v' ],
108
109
  # search
109
110
  :'playlist.search_next' => [?n ],
110
111
  :'playlist.search_prev' => [?N ],
111
112
  :'playlist.search_up' => [?? ],
112
113
  :'playlist.search_down' => [?/ ],
113
114
  # playlist
114
- :'playlist.play' => [ Curses::KEY_ENTER ],
115
+ :'playlist.play' => [ ICurses::KEY_ENTER ],
115
116
  :'playlist.download_album' => [?$ ],
116
117
  :'playlist.reload' => [?r ],
117
118
  :'playlist.goto_current' => [?o ],
@@ -121,12 +122,14 @@ module Ektoplayer
121
122
  :'player.toggle' => [' ' ]},
122
123
  browser: {
123
124
  # movement
124
- :'browser.top' => [?g, Curses::KEY_HOME ],
125
- :'browser.bottom' => [?G, Curses::KEY_END ],
126
- :'browser.up' => [?k, Curses::KEY_UP ],
127
- :'browser.down' => [?j, Curses::KEY_DOWN ],
128
- :'browser.page_up' => ['^u', Curses::KEY_PPAGE ],
129
- :'browser.page_down' => ['^d', Curses::KEY_NPAGE ],
125
+ :'browser.top' => [?g, ICurses::KEY_HOME ],
126
+ :'browser.bottom' => [?G, ICurses::KEY_END ],
127
+ :'browser.up' => [?k, ICurses::KEY_UP ],
128
+ :'browser.down' => [?j, ICurses::KEY_DOWN ],
129
+ :'browser.page_up' => ['^u', ICurses::KEY_PPAGE ],
130
+ :'browser.page_down' => ['^d', ICurses::KEY_NPAGE ],
131
+ # selection
132
+ :'browser.toggle_selection' => ['^v' ],
130
133
  # search
131
134
  :'browser.search_next' => [?n ],
132
135
  :'browser.search_prev' => [?N ],
@@ -134,22 +137,22 @@ module Ektoplayer
134
137
  :'browser.search_down' => [?/ ],
135
138
  # browser
136
139
  :'browser.add_to_playlist' => [' ', ?a ],
137
- :'browser.enter' => [ Curses::KEY_ENTER ],
138
- :'browser.back' => [?B, Curses::KEY_BACKSPACE ]},
140
+ :'browser.enter' => [ ICurses::KEY_ENTER ],
141
+ :'browser.back' => [?B, ICurses::KEY_BACKSPACE ]},
139
142
  help: {
140
- :'help.top' => [?g, Curses::KEY_HOME ],
141
- :'help.bottom' => [?G, Curses::KEY_END ],
142
- :'help.up' => [?k, Curses::KEY_UP ],
143
- :'help.down' => [?j, Curses::KEY_DOWN ],
144
- :'help.page_up' => ['^u', Curses::KEY_PPAGE ],
145
- :'help.page_down' => ['^d', Curses::KEY_NPAGE ]},
143
+ :'help.top' => [?g, ICurses::KEY_HOME ],
144
+ :'help.bottom' => [?G, ICurses::KEY_END ],
145
+ :'help.up' => [?k, ICurses::KEY_UP ],
146
+ :'help.down' => [?j, ICurses::KEY_DOWN ],
147
+ :'help.page_up' => ['^u', ICurses::KEY_PPAGE ],
148
+ :'help.page_down' => ['^d', ICurses::KEY_NPAGE ]},
146
149
  info: {
147
- :'info.top' => [?g, Curses::KEY_HOME ],
148
- :'info.bottom' => [?G, Curses::KEY_END ],
149
- :'info.up' => [?k, Curses::KEY_UP ],
150
- :'info.down' => [?j, Curses::KEY_DOWN ],
151
- :'info.page_up' => ['^u', Curses::KEY_PPAGE ],
152
- :'info.page_down' => ['^d', Curses::KEY_NPAGE ]},
150
+ :'info.top' => [?g, ICurses::KEY_HOME ],
151
+ :'info.bottom' => [?G, ICurses::KEY_END ],
152
+ :'info.up' => [?k, ICurses::KEY_UP ],
153
+ :'info.down' => [?j, ICurses::KEY_DOWN ],
154
+ :'info.page_up' => ['^u', ICurses::KEY_PPAGE ],
155
+ :'info.page_down' => ['^d', ICurses::KEY_NPAGE ]},
153
156
  splash: {}
154
157
  }
155
158
 
@@ -163,30 +166,33 @@ module Ektoplayer
163
166
  end
164
167
 
165
168
  def keyname(key)
166
- return 'SPACE' if key.to_s == ' '
167
- return key.to_s if key.is_a? Symbol
169
+ return 'SPACE' if (key == ' ' or key == 32)
168
170
 
169
- name = Curses.keyname(key)
171
+ name = ICurses.keyname(key)
170
172
  if name.start_with? 'KEY_'
171
- name.sub('KEY_', '').sub(/\((\d+)\)/, '\1')
173
+ name.sub('KEY_', '').delete('()')
172
174
  else
173
175
  name
174
176
  end
175
177
  end
176
178
 
177
179
  def parse_key(key)
178
- if key.is_a? Integer
179
- key
180
- elsif key.size == 1
181
- key.to_sym
182
- elsif key.size == 2 and key.start_with?(?^)
183
- Curses.const_get("KEY_CTRL_#{key[1].upcase}")
180
+ return key if key.is_a? Integer
181
+
182
+ if key.size == 1
183
+ return key.ord
184
+ elsif key.size == 2 and key[0] == ?^
185
+ return key[1].upcase.ord - 64
184
186
  elsif key =~ /^(key_)?space$/i
185
- :' '
186
- else
187
+ return ' '.ord
188
+ end
189
+
190
+ begin
191
+ return Integer(key)
192
+ rescue
187
193
  key = key.upcase.tr(?-, ?_)
188
194
  key = "KEY_#{key}" unless key.start_with?('KEY_')
189
- Curses.const_get(key)
195
+ return ICurses.const_get(key)
190
196
  end
191
197
  rescue NameError
192
198
  fail "Unknown key: #{key}"
@@ -1,5 +1,5 @@
1
- require 'zip'
2
1
  require 'thread'
2
+ require 'open3'
3
3
 
4
4
  class ConditionSignals
5
5
  def initialize
@@ -39,10 +39,6 @@ class ConditionSignals
39
39
  end
40
40
  end
41
41
 
42
- class Object
43
- alias :frz :freeze
44
- end
45
-
46
42
  class Dir
47
43
  def Dir.size(path)
48
44
  Dir.glob(File.join(path, '**', ?*)).map { |f| File.size(f) }.sum
@@ -83,13 +79,30 @@ module Common
83
79
  )
84
80
  end
85
81
  end
86
-
82
+
87
83
  def self.extract_zip(zip_file, dest)
84
+ # try RubyZip gem
85
+ require 'zip'
86
+
88
87
  Zip::File.open(zip_file) do |zip_obj|
89
88
  zip_obj.each do |f|
90
89
  f.extract(File.join(dest, f.name))
91
90
  end
92
91
  end
92
+ rescue LoadError
93
+ # try 'unzip'
94
+ out, err, status = Open3.capture3('unzip', ?x, zip_file, chdir: dest)
95
+ fail err unless status.exitcode == 0
96
+ rescue Error::ENOENT
97
+ # try '7zip'
98
+ out, err, status = Open3.capture3('7z', ?x, zip_file, chdir: dest)
99
+ fail err unless status.exitcode == 0
100
+ rescue Error::ENOENT
101
+ fail 'neither RubzZip gem nor /bin/unzip or /bin/7z found'
102
+ rescue
103
+ # something failed ...
104
+ Ektoplayer::Application.log(self, "error extracting zip", zip, dest, $!)
105
+ fail $!
93
106
  end
94
107
 
95
108
  def self.with_hash_zip(keys, values)
@@ -1,4 +1,4 @@
1
- unless Array.public_method_defined? :sum
1
+ unless Array.respond_to? :sum
2
2
  class Array
3
3
  def sum
4
4
  result = 0
@@ -8,9 +8,9 @@ unless Array.public_method_defined? :sum
8
8
  end
9
9
  end
10
10
 
11
- unless Integer.public_method_defined? :clamp
11
+ unless Integer.respond_to? :clamp
12
12
  class Integer
13
- def clamp(min, max)
13
+ def clamp(min, max)
14
14
  if self < min
15
15
  min
16
16
  elsif self > max
@@ -159,16 +159,6 @@ module Ektoplayer
159
159
  reg 'progressbar.rest_char',
160
160
  'Character used for the rest of the line', ?~
161
161
 
162
- # - Volumemeter
163
- reg 'volumemeter.display',
164
- 'Enable/disable volumemeter', true
165
-
166
- reg 'volumemeter.level_char',
167
- 'Character used for displaying volume level', ?~
168
-
169
- reg 'volumemeter.rest_char',
170
- 'Character used for the rest of the line', ?~
171
-
172
162
  # - Playinginfo
173
163
  reg 'playinginfo.display',
174
164
  'Enable/display playinginfo', true
@@ -190,7 +180,7 @@ module Ektoplayer
190
180
  lambda { |v| v.split(/\s*,\s*/).map(&:to_sym) }
191
181
 
192
182
  reg 'main.widgets', 'Specify widgets to show (up to down)',
193
- 'playinginfo,progressbar,tabbar,windows,volumemeter',
183
+ 'playinginfo,tabbar,windows,progressbar',
194
184
  lambda { |v| v.split(/\s*,\s*/).map(&:to_sym) }
195
185
  end
196
186
 
@@ -1,4 +1,4 @@
1
- require 'curses'
1
+ require_relative '../icurses'
2
2
 
3
3
  require_relative 'controller'
4
4
 
@@ -12,7 +12,7 @@ module Ektoplayer
12
12
  register = view_operations.with_register('browser.')
13
13
 
14
14
  %w(up down page_up page_down top bottom
15
- search_up search_down search_next search_prev).
15
+ search_up search_down search_next search_prev toggle_selection).
16
16
  each { |op| register.(op, &view.method(op)) }
17
17
 
18
18
  register.(:enter) do
@@ -21,7 +21,9 @@ module Ektoplayer
21
21
 
22
22
  register.(:add_to_playlist) do
23
23
  #if tracks = browser.tracks(view.selected)
24
- operations.send(:'browser.add_to_playlist', view.selected)
24
+ view.get_selection.each do |index|
25
+ operations.send(:'browser.add_to_playlist', index)
26
+ end
25
27
  #end
26
28
  end
27
29
 
@@ -29,14 +31,14 @@ module Ektoplayer
29
31
  view.mouse.on(65536) do view.up(5) end
30
32
  view.mouse.on(2097152) do view.down(5) end
31
33
 
32
- [Curses::BUTTON1_DOUBLE_CLICKED, Curses::BUTTON3_CLICKED].each do |btn|
34
+ [ICurses::BUTTON1_DOUBLE_CLICKED, ICurses::BUTTON3_CLICKED].each do |btn|
33
35
  view.mouse.on(btn) do |mevent|
34
36
  view.select_from_cursorpos(mevent.y)
35
37
  view_operations.send(:'browser.enter')
36
38
  end
37
39
  end
38
40
 
39
- [Curses::BUTTON1_CLICKED, Curses::BUTTON2_CLICKED].
41
+ [ICurses::BUTTON1_CLICKED, ICurses::BUTTON2_CLICKED].
40
42
  each do |button|
41
43
  view.mouse.on(button) do |mevent|
42
44
  view.select_from_cursorpos(mevent.y)