ektoplayer 0.1.22 → 0.1.24.a

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
  SHA256:
3
- metadata.gz: 4b60f202ee351cc05c1d1ca2fc88fabcc6f8e313206f2f63e9cfd297c52bf05d
4
- data.tar.gz: 25448d29ab6de9d71f3f48faee4b57e10f96673b4c6cc0fe996895a2d38bd752
3
+ metadata.gz: e07a8f4ec7d580ca4b4b901f1004da8f0000b7254e3d50777311052541280a37
4
+ data.tar.gz: 999a0502f214d570ec5eef7929807f04f35dd6e182591b208c3dbbcd460a4243
5
5
  SHA512:
6
- metadata.gz: c22e90577ead6e1e5504757dc03042bee36d919b4990adf58b6250c6d4df6381e5439765a7a640d2835f1b282037505754386061969dc7cdd40dba8f3b78366f
7
- data.tar.gz: c7d54c8d3987ad1bce0d65fd9eb6d58e588e11c137f8d091b2e4323ef04f9bec01eac17757c91b53dd077faebaab07ab9f97c35776325e4cd3effba03e249d0a
6
+ metadata.gz: d6cb6faea7ddc50b86d572d10d9b1f6f655d3cb6760f383d924282fe1656d344746e4212c7e8020ca65418535f538c72f4581ce01b8d5fd18cb3e186e88560d3
7
+ data.tar.gz: 7bcd8e8e43adbf34dac70d516af5d08017494ab00754334a63ad1911f73ad88f63142f98698ba5df3af63befd22d91cc564b2ab52fbc7ff129db2fb23e22a719
data/README.md CHANGED
@@ -46,13 +46,21 @@ See output of `gem env gempath`.
46
46
  yaourt -S ektoplayer
47
47
  ```
48
48
 
49
+ * Using makepkg:
50
+ ```
51
+ git clone https://github.com/braph/ektoplayer
52
+ cd ektoplayer
53
+ makepkg
54
+ sudo pacman -U ektoplayer-*.pkg.tar.xz
55
+ ```
56
+
49
57
  * Using gem:
50
58
  ```
51
59
  pacman -S --needed ruby mpg123 sqlite3 ncurses
52
60
  gem install ektoplayer
53
61
  ```
54
62
 
55
- ### Debian
63
+ ### Debian (*)
56
64
  * Using gem:
57
65
  ```
58
66
  apt-get install ruby ruby-dev libz libz-dev ruby-ncurses ruby-nokogiri ruby-sqlite3 \
@@ -60,7 +68,7 @@ See output of `gem env gempath`.
60
68
  gem install ektoplayer
61
69
  ```
62
70
 
63
- ### OpenSuse
71
+ ### OpenSuse (*)
64
72
  * Using gem:
65
73
  ```
66
74
  zypper in ruby ruby-devel gcc sqlite3 sqlite3-devel ncurses ncurses-devel zlib zlib-devel \
@@ -68,13 +76,15 @@ See output of `gem env gempath`.
68
76
  gem install ektoplayer ffi-curses
69
77
  ```
70
78
 
71
- ### Ubuntu
79
+ ### Ubuntu (*)
72
80
  * Using gem:
73
81
  ```
74
82
  apt-get install ruby ruby-dev sqlite3 ruby-sqlite3 ruby-nokogiri ruby-ncurses mpg123
75
83
  gem install ektoplayer
76
84
  ```
77
85
 
86
+ (*) Not tested yet
87
+
78
88
  ## Configuration
79
89
 
80
90
  Ektoplayer keeps it's default configuration file under `~/.config/ektoplayer/ektoplayer.rc`.
@@ -10,19 +10,16 @@ require 'date'
10
10
 
11
11
  module Ektoplayer
12
12
  class Application
13
- VERSION = '0.1.22'.freeze
14
- GITHUB_URL = 'https://github.com/braph/ektoplayer'.freeze
15
- EKTOPLAZM_URL = 'http://www.ektoplazm.com'.freeze
13
+ VERSION = '0.1.24'.freeze
14
+ GITHUB_URL = 'https://github.com/braph/ektoplayer'.freeze
15
+ EKTOPLAZM_URL = 'https://ektoplazm.com'.freeze
16
16
 
17
17
  EKTOPLAZM_ALBUM_BASE_URL = "#{EKTOPLAZM_URL}/free-music".freeze
18
18
  EKTOPLAZM_COVER_BASE_URL = "#{EKTOPLAZM_URL}/img".freeze
19
- EKTOPLAZM_TRACK_BASE_URL = "#{EKTOPLAZM_URL}/mp3".freeze
19
+ EKTOPLAZM_TRACK_BASE_URL = "#{EKTOPLAZM_URL}/audio".freeze
20
20
  EKTOPLAZM_STYLE_BASE_URL = "#{EKTOPLAZM_URL}/style".freeze
21
21
  EKTOPLAZM_ARCHIVE_BASE_URL = "#{EKTOPLAZM_URL}/files".freeze
22
22
 
23
- CONFIG_DIR = File.join(Dir.home, '.config', 'ektoplayer').freeze
24
- CONFIG_FILE = File.join(CONFIG_DIR, 'ektoplayer.rc').freeze
25
-
26
23
  def self.album_url(album)
27
24
  "#{EKTOPLAZM_ALBUM_BASE_URL}/#{album}"
28
25
  end
@@ -107,7 +104,7 @@ module Ektoplayer
107
104
  client = Client.new
108
105
 
109
106
  # ... models ...
110
- player = Models::Player.new(client)
107
+ player = Models::Player.new(client, Config[:audio_system])
111
108
  browser = Models::Browser.new(client)
112
109
  playlist = Models::Playlist.new
113
110
  database = Models::Database.new(client)
@@ -16,14 +16,14 @@ module Ektoplayer
16
16
 
17
17
  attr_reader :albums, :page_urls, :current_page_index
18
18
 
19
- def self.parse(src)
20
- BrowsePage.new(src)
19
+ def self.from_url(url)
20
+ BrowsePage.new(open(url))
21
21
  end
22
22
 
23
23
  def styles; @@styles or [] end
24
24
  def first_page_url; @page_urls[0] end
25
25
  def last_page_url; @page_urls[-1] end
26
- def current_page_url; @page_urls[@current_page_index] end
26
+ def current_page_url; @page_urls[@current_page_index - 1] end
27
27
 
28
28
  def prev_page_url
29
29
  @page_urls[@current_page_index - 1] if @current_page_index > 0
@@ -34,14 +34,14 @@ module Ektoplayer
34
34
  end
35
35
 
36
36
  def initialize(src)
37
- doc = Nokogiri::HTML(open(src))
37
+ doc = Nokogiri::HTML(src)
38
38
  @albums = []
39
39
 
40
- @page_urls = []
41
- doc.css('.wp-pagenavi option').each_with_index do |option, i|
42
- @current_page_index = i if option['selected']
43
- @page_urls << option['value']
44
- end
40
+ base_url = doc.css('.wp-pagenavi a')[0]['href'].sub(/\d+$/, '')
41
+ pages = doc.css('.wp-pagenavi .pages')[0].text # -> "Page 1 of 22"
42
+ @current_page_index, last = pages.gsub(/[^\d ]/, '').split()
43
+ @current_page_index, last = @current_page_index.to_i, last.to_i
44
+ @page_urls = (1..last).map do |i| "#{base_url}#{i}" end
45
45
 
46
46
  @@styles ||= begin
47
47
  doc.xpath('//a[contains(@href, "http") and contains(@href, "/style/")]').map do |a|
@@ -87,14 +87,22 @@ module Ektoplayer
87
87
  album[:rating], album[:votes] = 0, 0
88
88
  end
89
89
 
90
- begin
91
- base64_tracklist = post.at_css('script').text.scan(/soundFile:"(.*)"/)[0][0]
92
- tracklist_urls = Base64.decode64(base64_tracklist).split(?,)
93
- tracklist_urls.map! { |url| File.basename(url) }
94
- rescue
90
+ # Extract audio file URLs
91
+ tracklist_urls = []
92
+ post.xpath('.//script').each do |script|
93
+ soundFile = script.text.scan(/soundFile:"(.*)"/)
94
+ if soundFile.size > 0
95
+ soundFile = soundFile[0][0]
96
+ tracklist_urls = Base64.decode64(soundFile).split(?,)
97
+ tracklist_urls.map! { |url| File.basename(url) }
98
+ break
99
+ end
100
+ end
101
+ #
102
+ unless tracklist_urls.size > 0
95
103
  # Sometimes there are no tracks:
96
104
  # http://www.ektoplazm.com/free-music/dj-basilisk-the-colours-of-ektoplazm
97
- tracklist_urls = []
105
+ Application.log(self, "Found no tracks for #{album[:title]} on #{current_page_url}")
98
106
  end
99
107
 
100
108
  post.css('.tl').each do |album_track_list|
@@ -84,7 +84,7 @@ module Ektoplayer
84
84
  # parameter `description` is used by tools/mkconfig.rb, but not here
85
85
 
86
86
  if method
87
- @cast[key.to_sym] = method if method
87
+ @cast[key.to_sym] = method
88
88
  @options[key.to_sym] = method.(default).freeze
89
89
  else
90
90
  @options[key.to_sym] = default.freeze
@@ -104,9 +104,10 @@ module Ektoplayer
104
104
  File.join(CONFIG_DIR, 'ektoplayer.log'),
105
105
  File.method(:expand_path)
106
106
 
107
- reg :temp_dir, %{Temporary dir for downloading mp3 files. They will be moved to `cache_dir`
108
- after the download completed and was successful.
109
- Directory will be created if it does not exist, parent directories will not be created.},
107
+ reg :temp_dir,
108
+ %{Temporary dir for downloading mp3 files.
109
+ They will be moved to `cache_dir` after the download completed and was successful.
110
+ Directory will be created if it does not exist, parent directories will not be created.},
110
111
  '/tmp/.ektoplazm',
111
112
  File.method(:expand_path)
112
113
 
@@ -143,7 +144,7 @@ module Ektoplayer
143
144
  be deleted on application exit.}, true
144
145
 
145
146
  reg :prefetch,
146
- 'Enable prefetching next track do be played', true
147
+ 'Enable prefetching the next track do be played', true
147
148
 
148
149
  reg :small_update_pages,
149
150
  'How many pages should be fetched after start', 5
@@ -155,6 +156,10 @@ module Ektoplayer
155
156
  '8' => 8, '256' => 256 }[v] or fail 'invalid value'
156
157
  }
157
158
 
159
+ reg :audio_system,
160
+ 'Set output audio system. See option `-o` in mpg123(1)',
161
+ 'pulse,alsa,jack,oss'
162
+
158
163
  reg :threads,
159
164
  'Number of download threads during database update',
160
165
  20, lambda { |v| fail if Integer(v) < 1; Integer(v) }
@@ -63,7 +63,7 @@ module ICurses
63
63
  module_function :initscr
64
64
 
65
65
  def stdscr
66
- ICurses::IWindow.new Ncurses.stdscr
66
+ ICurses::IWindow.new( Ncurses.stdscr )
67
67
  end
68
68
  module_function :stdscr
69
69
 
@@ -2,9 +2,10 @@ module ICurses
2
2
  class IMouseEvent
3
3
  attr_accessor :x, :y, :z, :bstate
4
4
 
5
- def initialize(mouse_event=nil, bstate: 0, x: 0, y: 0, z: 0)
6
- @x, @y, @z, @bstate = x, y, z, bstate
7
- from_mouse_event!(mouse_event)
5
+ def initialize(mouse_event=nil, bstate: nil, x: nil, y: nil, z: nil)
6
+ @x, @y, @z, @bstate = 0, 0, 0, 0
7
+ from_mouse_event!(mouse_event) if mouse_event
8
+ update!(x:x, y:y, z:z, bstate:bstate)
8
9
  end
9
10
 
10
11
  def [](key) send(key) end
@@ -13,9 +14,7 @@ module ICurses
13
14
  def from_mouse_event!(m)
14
15
  @x, @y, @z, @bstate = m.x, m.y, m.z, m.bstate
15
16
  rescue
16
- begin @x, @y, @z, @bstate = m[:x], m[:y], m[:z], m[:bstate]
17
- rescue
18
- end
17
+ @x, @y, @z, @bstate = m[:x], m[:y], m[:z], m[:bstate]
19
18
  end
20
19
 
21
20
  def update!(x: nil, y: nil, z: nil, bstate: nil)
@@ -28,6 +27,7 @@ module ICurses
28
27
  end
29
28
 
30
29
  module ICurses
30
+ # Alias methods (`LINES` becomes `lines`, etc ...)
31
31
  %w(lines cols colors init_pair color_pair).each do |meth|
32
32
  meth_up = meth.upcase
33
33
 
@@ -53,6 +53,7 @@ module ICurses
53
53
  alias_method(:<<, :addstr)
54
54
  end
55
55
 
56
+ # Provide `curx` as well as `getcurx`
56
57
  %w(curx cury maxx maxy begx begy).each do |meth|
57
58
  full = 'get' + meth
58
59
  if not respond_to? meth
@@ -18,8 +18,9 @@ No module for ncurses found. Please install one of the following gems:
18
18
  Maybe your distribution ships one of these already as a package.
19
19
 
20
20
  Arch Linux:
21
- yaourt -S ruby-curses # or
22
- yaourt -S ruby-ncursesw
21
+ yaourt -S ruby-ncursesw # preferred
22
+ or
23
+ yaourt -S ruby-curses
23
24
 
24
25
  Debian / Ubuntu:
25
26
  apt-get install ruby-ncurses
@@ -4,10 +4,10 @@ require_relative '../players/mpg_wrapper_player'
4
4
  module Ektoplayer
5
5
  module Models
6
6
  class Player < Model
7
- def initialize(client)
7
+ def initialize(client, audio_system)
8
8
  super()
9
9
  @client = client
10
- @player = MpgWrapperPlayer.new
10
+ @player = MpgWrapperPlayer.new(audio_system)
11
11
  @events = @player.events
12
12
  #@events.register(:position_change, :track_completed, :pause, :stop, :play)
13
13
  #@player.events.on_all(&@events.method(:trigger))
@@ -16,7 +16,8 @@ class MpgWrapperPlayer
16
16
  CMD_FORMAT = 'FORMAT'.freeze
17
17
  CMD_SAMPLE = 'SAMPLE'.freeze
18
18
 
19
- def initialize
19
+ def initialize(audio_system)
20
+ @audio_system = audio_system
20
21
  @events = Events.new(:play, :pause, :stop, :position_change)
21
22
  @lock = Mutex.new
22
23
  @mpg123_in, @mpg123_out, @mpg123_thread = nil, nil, nil
@@ -29,7 +30,11 @@ class MpgWrapperPlayer
29
30
  @track_completed = nil
30
31
  end
31
32
 
32
- def can_http?; true; end
33
+ # NOTE
34
+ # Since ektoplazm.com switched to Cloudflare (using HTTP/2.0) mpg123
35
+ # cannot handle those streams anymore. This may change in future versions
36
+ # of mpg123.
37
+ def can_http?; false; end
33
38
 
34
39
  def play(file=nil)
35
40
  start_mpg123_thread
@@ -133,7 +138,7 @@ class MpgWrapperPlayer
133
138
  Thread.new do
134
139
  begin
135
140
  @mpg123_in, @mpg123_out, mpg123_err, @mpg123_thread =
136
- Open3.popen3('mpg123', '--fuzzy', '-R')
141
+ Open3.popen3('mpg123', '-o', @audio_system, '--fuzzy', '-R')
137
142
 
138
143
  while (line = @mpg123_out.readline)
139
144
  cmd, line = line.split(' ', 2)
@@ -5,7 +5,7 @@ require 'open-uri'
5
5
  require_relative 'browsepage'
6
6
 
7
7
  module Ektoplayer
8
- MAIN_URL = 'http://www.ektoplazm.com'.freeze
8
+ MAIN_URL = 'https://ektoplazm.com'.freeze
9
9
  FREE_MUSIC_URL = "#{MAIN_URL}/section/free-music".freeze
10
10
 
11
11
  class DatabaseUpdater
@@ -21,7 +21,7 @@ module Ektoplayer
21
21
  def update(start_url: FREE_MUSIC_URL, pages: 0, parallel: 10)
22
22
  queue = parallel > 0 ? SizedQueue.new(parallel) : Queue.new
23
23
  results = Queue.new
24
- bp = BrowsePage.new(start_url)
24
+ bp = BrowsePage.from_url(start_url)
25
25
  results << bp
26
26
 
27
27
  insert_thread = Thread.new do
@@ -43,7 +43,7 @@ module Ektoplayer
43
43
 
44
44
  3.times do |try|
45
45
  begin
46
- bp = BrowsePage.new(url)
46
+ bp = BrowsePage.from_url(url)
47
47
  Application.log(self, url, bp.albums.size, "albums found")
48
48
  results << bp
49
49
  break
@@ -6,32 +6,32 @@ require_relative '../common'
6
6
  module Ektoplayer
7
7
  module Views
8
8
  class Splash < UI::Window
9
- EKTOPLAZM_LOGO = %q.
10
- ____ _ _ _ ____ _ _____ ______ _ ___ ___
9
+ EKTOPLAZM_LOGO = %q[
10
+ ____ _ _ _ ____ _ _____ ______ _ ___ ___
11
11
  / __) ; | | ; | | | _ \ | | /___ \ |____ | | '_ `_ \
12
12
  / / | | | | _| |__ ___ | | | | | | | | | | | | | | | |
13
- ( ( | | | | |_ __) / _ \ | | | | | | ___| | / , | | | | | |
13
+ ( ( | | | | |_ __) / _ \ | | | | | | ___| | / ; | | | | | |
14
14
  \ \_ | | | | | | | | | | | | | | | | / _| | / / | | | | | |
15
15
  ) _) | | | | | | | | | | | |_| ; | | | | | | / / | | | | | |
16
16
  / / | |_|/ | | | |_| | | __/ | | | | | | / / | | | | | |
17
17
  ( ( | _{ | | \___/ | | | | | | | | / / | | |_| | |
18
- \ \__ | | |\ | |__ | | | :___ | |_| | , /____ | | | |
19
- \____) |_| |_| \___/ |_| \____/ \_____| |______| |_| |_|..
18
+ \ \__ | | |\ | |__ | | | :___ | |_| | : /____ | | | |
19
+ \____) |_| |_| \___/ |_| \____/ \_____| |______| |_| |_|].
20
20
  split(?\n)[1..-1].freeze
21
- EKTOPLAZM_SIGNATURE = %q{
22
- ___ _ _ _ _ _ _
23
- / __| ___ _ _ _ _ __| | | | (_) |__ ___ _ _ __ _| |_(_)___ _ _
24
- \__ \/ _ \ || | ' \/ _` | | |__| | '_ \/ -_) '_/ _` | _| / _ \ ' \
25
- |___/\___/\_,_|_||_\__,_| |____|_|_.__/\___|_| \__,_|\__|_\___/_||_|}.
21
+ EKTOPLAZM_SIGNATURE = %q[
22
+ ___ _ _ _ _ _ _
23
+ / __| ___ _ _ _ _ __| | | | (_) |__ ___ _ _ __ _| |_(_)___ _ _
24
+ \__ \/ _ \ || | ' \/ _` | | |__| | '_ \/ -_) '_/ _` | _| / _ \ ' \
25
+ |___/\___/\_,_|_||_\__,_| |____|_|_.__/\___|_| \__,_|\__|_\___/_||_|].
26
26
  split(?\n)[1..-1].freeze
27
27
 
28
28
  BUBBLES = [[6,3], [6,7], [28,1], [28,9], [46,7], [71,9]].freeze
29
29
 
30
- def load_colors
30
+ def load_colorfaders
31
31
  if Theme.current == 256
32
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])
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])
35
35
  elsif Theme.current == 8
36
36
  @bubble_fade = UI::ColorFader.new([:red])
37
37
  @ekto_logo_fade = UI::ColorFader.new([:blue])
@@ -44,12 +44,12 @@ module Ektoplayer
44
44
  def draw
45
45
  @win.erase
46
46
  return if (EKTOPLAZM_LOGO.size >= @size.height or
47
- EKTOPLAZM_LOGO.max.size >= @size.width)
48
- load_colors
47
+ EKTOPLAZM_LOGO[0].size >= @size.width)
48
+ load_colorfaders unless @bubble_fade#,@signature_fade,@ekto_logo_fade
49
49
 
50
50
  w_center = @size.width / 2
51
51
  h_center = @size.height / 2
52
- left_pad = w_center - (EKTOPLAZM_LOGO.max.size / 2)
52
+ left_pad = w_center - (EKTOPLAZM_LOGO[0].size / 2)
53
53
 
54
54
  if EKTOPLAZM_LOGO.size + EKTOPLAZM_SIGNATURE.size + 3 > @size.height
55
55
  top_pad = h_center - (EKTOPLAZM_LOGO.size / 2)
@@ -75,7 +75,7 @@ module Ektoplayer
75
75
  return unless draw_signature
76
76
 
77
77
  top_pad += EKTOPLAZM_LOGO.size + 2
78
- left_pad = w_center - (EKTOPLAZM_SIGNATURE.max.size / 2)
78
+ left_pad = w_center - (EKTOPLAZM_SIGNATURE[0].size / 2)
79
79
 
80
80
  EKTOPLAZM_SIGNATURE.each_with_index do |line, i|
81
81
  @win.move(top_pad + i, left_pad)
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.22
4
+ version: 0.1.24.a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Abendroth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-17 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: scanf
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
41
55
  description: Ektoplayer is a commandline client for http://ektoplazm.com, a website
42
56
  providing free electronic music such as techno, goa and psy-trance
43
57
  email: braph93@gmx.de
@@ -122,15 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
136
  version: '0'
123
137
  required_rubygems_version: !ruby/object:Gem::Requirement
124
138
  requirements:
125
- - - ">="
139
+ - - ">"
126
140
  - !ruby/object:Gem::Version
127
- version: '0'
141
+ version: 1.3.1
128
142
  requirements:
129
143
  - 'Playback: /bin/mpg123 or the "audite-lib" gem'
130
144
  - 'Archive unpacking: /bin/unzip, /bin/7z or the "rubyzip" gem'
131
145
  - 'One of these curses-gems: ffi-ncurses, ncurses, ncursesw, curses'
132
- rubyforge_project:
133
- rubygems_version: 2.7.7
146
+ rubygems_version: 3.1.2
134
147
  signing_key:
135
148
  specification_version: 4
136
149
  summary: play or download music from ektoplazm.com