ektoplayer 0.1.11 → 0.1.12

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: 54b54fea7b6eb4691e5c49ddddd3b9d46df9a591
4
- data.tar.gz: 82b7a0d329781ac90e61671a7e89c5b3cf7002c3
3
+ metadata.gz: fb06ab1d760e586affdc548cf3c622323736700c
4
+ data.tar.gz: 147c4ab4a4a71f4acae9bcc963da610daba75f2c
5
5
  SHA512:
6
- metadata.gz: 2015220c85d70a99d0c1c1fddc255781e19c1eba905a185371e1c465d08d4c31f1c300de772bd9cbf2ffc61683443a4cad3eda426ed6de91acc83ffc0b930806
7
- data.tar.gz: a35820777f4373bd8587bd61fa56d66ed2b02483c49ee3ab2f671b4448cadb700ab7a8da4683d1f4874f101d18da58e1bc4dc9ec78d7dcd5ffb8e7a8282ebcd3
6
+ metadata.gz: ab09617d8346b932adb34879a6400c79af7c8e14e348908161d0bd9f1bfc1b9a35547504c1dbdda0d281dda13435a2b3fdf03b6a0ed45d3710cc761d4ff1d0dc
7
+ data.tar.gz: ec888b4104511631aa3d3366896e2591252d398cfeece159bd7027de2860470b6b7144b03998af879461f75af5fbd17fcdf1ccad7ae910a1df1b8853550f44e9
@@ -10,9 +10,11 @@ require 'date'
10
10
 
11
11
  module Ektoplayer
12
12
  class Application
13
- VERSION = '0.1.11'.freeze
13
+ VERSION = '0.1.12'.freeze
14
14
  GITHUB_URL = 'https://github.com/braph/ektoplayer'.freeze
15
15
  EKTOPLAZM_URL = 'http://www.ektoplazm.com'.freeze
16
+ EKTOPLAZM_ALBUM_BASE_URL = EKTOPLAZM_URL + '/free-music'.freeze
17
+ EKTOPLAZM_COVER_BASE_URL = EKTOPLAZM_URL + '/img'.freeze
16
18
 
17
19
  CONFIG_DIR = File.join(Dir.home, '.config', 'ektoplayer').freeze
18
20
  CONFIG_FILE = File.join(CONFIG_DIR, 'ektoplayer.rc').freeze
@@ -4,6 +4,7 @@ require 'nokogiri'
4
4
  require 'date'
5
5
  require 'base64'
6
6
  require 'scanf'
7
+ require 'uri'
7
8
  require 'open-uri'
8
9
 
9
10
  module Ektoplayer
@@ -60,23 +61,32 @@ module Ektoplayer
60
61
  album[:styles] << a.text
61
62
  end
62
63
 
63
- album[:cover_url] = post.at_css('.cover')[:src] rescue nil
64
- album[:description] = post.at_css(?p).to_html rescue ''
64
+ album[:description] = post.at_css(?p).
65
+ to_html.sub(/^<p>/, '').sub(/<\/p>$/, '') rescue ''
66
+
67
+ begin album[:cover_url] = File.basename(
68
+ URI.parse(post.at_css('.cover')[:src]).path
69
+ )
70
+ rescue
71
+ end
72
+
65
73
  album[:download_count] = post.at_css('.dc strong').text.delete(?,).to_i rescue 0
66
74
 
67
75
  post.css('h1 a').each do |a|
68
76
  album[:title] = a.text
69
- album[:url] = a[:href]
77
+ album[:url] = File.basename(URI.parse(a[:href]).path)
70
78
  end
71
79
 
72
80
  post.xpath('.//a[@rel="tag"]').each do |a|
73
81
  album[:released_by] = a.text
74
- album[:released_by_url] = a[:href]
82
+ album[:released_by_url] = File.basename(URI.parse(a[:href]).path)
83
+ # todo
75
84
  end
76
85
 
77
86
  post.xpath('.//a[@rel="author external"]').each do |a|
78
87
  album[:posted_by] = a.text
79
- album[:posted_by_url] = a[:href]
88
+ album[:posted_by_url] = File.basename(URI.parse(a[:href]).path)
89
+ # todo
80
90
  end
81
91
 
82
92
  album[:archive_urls] = post.css('.dll a').map do |a|
@@ -69,6 +69,10 @@ module Ektoplayer
69
69
  end
70
70
  end
71
71
 
72
+ def get_cover_url(album)
73
+ "#{Application::EKTOPLAZM_COVER_BASE_URL}/#{album}"
74
+ end
75
+
72
76
  def draw
73
77
  return unless @player
74
78
 
@@ -108,7 +112,7 @@ module Ektoplayer
108
112
  draw_tag('Styles', @track['styles'].gsub(?,, ', '))
109
113
  draw_tag('Downloads', @track['download_count'])
110
114
  draw_tag('Rating', "%0.2d%% (%d Votes)" % [@track['rating'], @track['votes']])
111
- draw_tag('Cover'); draw_url(@track['cover_url'], 'Cover')
115
+ draw_tag('Cover'); draw_url(get_cover_url(@track['cover_url']), 'Cover')
112
116
  @win.next_line
113
117
 
114
118
  # -- description
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ektoplayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Abendroth
@@ -123,9 +123,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements:
126
- - 'For playback: /bin/mpg123 or the "audite-lib" RubyGem'
127
- - 'For archive extracting: /bin/unzip, /bin/7z or "rubyzip" RubyGem'
128
- - 'One of the following curses-gems: ffi-ncurses, curses'
126
+ - 'For playback: /bin/mpg123 or the "audite-lib" gem'
127
+ - 'For archive extracting: /bin/unzip, /bin/7z or the "rubyzip" gem'
128
+ - 'One of these curses-gems: ffi-ncurses, ncurses, ncursesw, curses'
129
129
  rubyforge_project:
130
130
  rubygems_version: 2.6.8
131
131
  signing_key: