unclekryon 0.4.9.pre.alpha → 0.4.12.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -26
- data/Gemfile.lock +20 -24
- data/README.md +3 -2
- data/Rakefile +11 -30
- data/bin/unclekryon +4 -15
- data/hax/kryon.yaml +28 -0
- data/hax/kryon_aums_2002-2005.yaml +460 -0
- data/hax/kryon_aums_2006.yaml +601 -0
- data/hax/kryon_aums_2007.yaml +1024 -0
- data/hax/kryon_aums_2008.yaml +950 -0
- data/hax/kryon_aums_2009.yaml +496 -0
- data/hax/kryon_aums_2010.yaml +1443 -0
- data/hax/kryon_aums_2011.yaml +1458 -0
- data/hax/kryon_aums_2012.yaml +2123 -0
- data/hax/kryon_aums_2013.yaml +1647 -0
- data/hax/kryon_aums_2014.yaml +2478 -0
- data/hax/kryon_aums_2015.yaml +3386 -0
- data/hax/kryon_aums_2016.yaml +3476 -0
- data/hax/kryon_aums_2017.yaml +3712 -0
- data/hax/kryon_aums_2018.yaml +3654 -0
- data/lib/unclekryon/data/album_data.rb +74 -82
- data/lib/unclekryon/data/artist_data.rb +24 -36
- data/lib/unclekryon/data/artist_data_data.rb +29 -41
- data/lib/unclekryon/data/aum_data.rb +20 -32
- data/lib/unclekryon/data/base_data.rb +27 -39
- data/lib/unclekryon/data/pic_data.rb +25 -37
- data/lib/unclekryon/data/release_data.rb +14 -26
- data/lib/unclekryon/data/social_data.rb +6 -18
- data/lib/unclekryon/data/timespan_data.rb +16 -28
- data/lib/unclekryon/dev_opts.rb +7 -19
- data/lib/unclekryon/hacker.rb +121 -135
- data/lib/unclekryon/iso/base_iso.rb +69 -81
- data/lib/unclekryon/iso/can_prov_terr.rb +34 -47
- data/lib/unclekryon/iso/country.rb +34 -51
- data/lib/unclekryon/iso/language.rb +84 -98
- data/lib/unclekryon/iso/region.rb +8 -29
- data/lib/unclekryon/iso/subregion.rb +8 -29
- data/lib/unclekryon/iso/usa_state.rb +28 -41
- data/lib/unclekryon/iso.rb +128 -138
- data/lib/unclekryon/jsoner.rb +31 -50
- data/lib/unclekryon/log.rb +34 -46
- data/lib/unclekryon/parsers/kryon_aum_year_album_parser.rb +163 -167
- data/lib/unclekryon/parsers/kryon_aum_year_parser.rb +122 -127
- data/lib/unclekryon/server.rb +8 -17
- data/lib/unclekryon/trainer.rb +68 -85
- data/lib/unclekryon/uploader.rb +8 -17
- data/lib/unclekryon/util.rb +80 -92
- data/lib/unclekryon/version.rb +4 -16
- data/lib/unclekryon.rb +166 -166
- data/train/kryon.yaml +6077 -0
- data/unclekryon.gemspec +49 -49
- metadata +50 -22
@@ -1,23 +1,11 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of UncleKryon-server.
|
7
|
-
# Copyright (c) 2017-
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# UncleKryon-server is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with UncleKryon-server. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2017-2021 Jonathan Bradley Whited
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
@@ -37,7 +25,7 @@ require 'unclekryon/data/release_data'
|
|
37
25
|
module UncleKryon
|
38
26
|
class KryonAumYearParser
|
39
27
|
include Logging
|
40
|
-
|
28
|
+
|
41
29
|
attr_accessor :artist
|
42
30
|
attr_accessor :exclude_album
|
43
31
|
attr_accessor :release
|
@@ -46,9 +34,9 @@ module UncleKryon
|
|
46
34
|
attr_accessor :training
|
47
35
|
attr_reader :updated_on
|
48
36
|
attr_accessor :url
|
49
|
-
|
37
|
+
|
50
38
|
alias_method :training?,:training
|
51
|
-
|
39
|
+
|
52
40
|
def initialize(title=nil,url=nil,artist=ArtistDataData.new(),training: false,train_filepath: nil,
|
53
41
|
updated_on: nil,**options)
|
54
42
|
@artist = artist
|
@@ -56,108 +44,114 @@ module UncleKryon
|
|
56
44
|
@title = title
|
57
45
|
@trainers = Trainers.new(train_filepath)
|
58
46
|
@training = training
|
59
|
-
@updated_on = Util.format_datetime(DateTime.now
|
47
|
+
@updated_on = Util.format_datetime(DateTime.now) if Util.empty_s?(updated_on)
|
60
48
|
@url = Util.empty_s?(url) ? self.class.get_kryon_year_url(title) : url
|
61
49
|
end
|
62
|
-
|
50
|
+
|
63
51
|
def self.parse_kryon_date(date,year=nil)
|
64
52
|
# Don't modify args and clean them up so can use /\s/ instead of /[[:space:]]/
|
65
|
-
date = Util.clean_data(date.clone
|
66
|
-
year = Util.clean_data(year.clone
|
67
|
-
|
53
|
+
date = Util.clean_data(date.clone)
|
54
|
+
year = Util.clean_data(year.clone)
|
55
|
+
|
68
56
|
# Fix misspellings and/or weird shortenings
|
69
57
|
date.gsub!(/Feburary/i,'February') # "Feburary 2-13, 2017"
|
70
58
|
date.gsub!(/SEPT(\s+|\-)/i,'Sep\1') # "SEPT 29 - OCT 9, 2017", "Sept-Oct 2015"
|
71
59
|
date.gsub!(/Septembe\s+/i,'September ') # "Septembe 4, 2016"
|
72
60
|
date.gsub!(/Ocotber/i,'October') # "Ocotber 10, 2015"
|
73
|
-
|
61
|
+
|
74
62
|
comma = date.include?(',') ? ',' : '' # "May 6 2017"
|
75
63
|
r = Array.new(2)
|
76
|
-
|
64
|
+
|
77
65
|
begin
|
78
66
|
if date.include?('-')
|
67
|
+
case date
|
79
68
|
# "Sept-Oct 2015"
|
80
|
-
|
69
|
+
when /\A[[:alpha:]]+\s*\-\s*[[:alpha:]]+\s+[[:digit:]]+\z/
|
81
70
|
r[1] = Date.strptime(date,'%b-%b %Y')
|
82
71
|
r[0] = Date.strptime(date,'%b')
|
83
72
|
r[0] = Date.new(r[1].year,r[0].month,r[0].day)
|
84
73
|
# "4/28/12 - 4/29/12"
|
85
|
-
|
74
|
+
when %r{\A[[:digit:]]+\s*/\s*[[:digit:]]+\s*/\s*[[:digit:]]+\s*\-}
|
86
75
|
date = date.split(/\s*-\s*/)
|
87
|
-
|
76
|
+
|
88
77
|
r[0] = Date.strptime(date[0],'%m/%d/%y')
|
89
78
|
r[1] = Date.strptime(date[1],'%m/%d/%y')
|
90
79
|
# "10-17 to 11-18, 2012"
|
91
|
-
|
80
|
+
when /\A[[:digit:]]+\s*\-\s*[[:digit:]]+\s+to\s+
|
81
|
+
[[:digit:]]+\s*\-\s*[[:digit:]]+\s*,\s*
|
82
|
+
[[:digit:]]+\z/xi
|
92
83
|
date = date.split(/\s*to\s*/i)
|
93
|
-
|
84
|
+
|
94
85
|
r[1] = Date.strptime(date[1],'%m-%d, %Y')
|
95
86
|
r[0] = Date.strptime(date[0],'%m-%d')
|
96
87
|
r[0] = Date.new(r[1].year,r[0].month,r[0].day)
|
97
88
|
else
|
89
|
+
case date
|
98
90
|
# "SEPT 29 - OCT 9, 2017", "May 31-June 1, 2014"
|
99
|
-
|
91
|
+
when /\A[[:alpha:]]+\s+[[:digit:]]+\s*\-\s*[[:alpha:]]+\s+[[:digit:]]+[\,\s]+[[:digit:]]+\z/
|
100
92
|
date = date.gsub(/\s*\-\s*/,'-')
|
101
93
|
r1f = "%B %d-%B %d#{comma} %Y"
|
102
94
|
# "OCT 25 - NOV 3" (2014)
|
103
|
-
|
95
|
+
when /\A[[:alpha:]]+\s+[[:digit:]]+\s*\-\s*[[:alpha:]]+\s+[[:digit:]]+\z/
|
104
96
|
date = date.gsub(/\s*\-\s*/,'-')
|
105
97
|
r1f = '%B %d-%B %d'
|
106
|
-
|
107
|
-
if !year.nil?
|
98
|
+
|
99
|
+
if !year.nil?
|
108
100
|
date << ", #{year}"
|
109
|
-
r1f <<
|
101
|
+
r1f << ', %Y'
|
110
102
|
end
|
111
103
|
# "December 12-13"
|
112
|
-
|
104
|
+
when /\A[[:alpha:]]+\s+[[:digit:]]+\s*\-\s*[[:digit:]]+\z/
|
113
105
|
date = date.gsub(/\s*\-\s*/,'-')
|
114
|
-
|
106
|
+
|
115
107
|
# "September 16 - 2018"
|
116
108
|
if date =~ /-[[:digit:]]{4}\z/
|
117
109
|
r1f = '%B %d-%Y'
|
118
110
|
else
|
119
|
-
r1f = '%B %d-%d'.dup
|
120
|
-
|
121
|
-
if !year.nil?
|
111
|
+
r1f = '%B %d-%d'.dup
|
112
|
+
|
113
|
+
if !year.nil?
|
122
114
|
date << ", #{year}"
|
123
115
|
r1f << ', %Y'
|
124
116
|
end
|
125
117
|
end
|
126
118
|
# "June 30-July 1-2018"
|
127
|
-
|
119
|
+
when /\A[[:alpha:]]+\s+[[:digit:]]+\s*\-\s*
|
120
|
+
[[:alpha:]]+\s+[[:digit:]]+\s*\-\s*
|
121
|
+
[[:digit:]]+\z/x
|
128
122
|
date = date.gsub(/\s*\-\s*/,'-')
|
129
123
|
r1f = '%B %d-%B %d-%Y'
|
130
124
|
# "September 7 & 9-2018"
|
131
|
-
|
125
|
+
when /\A[[:alpha:]]+\s+[[:digit:]]+\s+\&\s+[[:digit:]]+\s*\-\s*[[:digit:]]+\z/
|
132
126
|
date = date.gsub(/\s*\-\s*/,'-')
|
133
127
|
r1f = '%B %d & %d-%Y'
|
134
128
|
else
|
135
129
|
# "OCT 27 - 28 - 29, 2017"; remove spaces around dashes
|
136
130
|
date.gsub!(/\s+\-\s+/,'-')
|
137
|
-
|
131
|
+
|
138
132
|
# "June 7-9-16-17" & "June 9-10-11-12"
|
139
133
|
if date =~ /\A[[:alpha:]]+\s*[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+\-[[:digit:]]+\z/
|
140
|
-
r1f =
|
141
|
-
|
142
|
-
if !year.nil?
|
134
|
+
r1f = '%B %d-%d-%d-%d'
|
135
|
+
|
136
|
+
if !year.nil?
|
143
137
|
date << ", #{year}"
|
144
|
-
r1f <<
|
138
|
+
r1f << ', %Y'
|
145
139
|
end
|
146
140
|
else
|
147
141
|
# "MAY 15-16-17, 2017" and "January 7-8, 2017"
|
148
142
|
r1f = (date =~ /\-.*\-/) ? "%B %d-%d-%d#{comma} %Y" : "%B %d-%d#{comma} %Y"
|
149
143
|
end
|
150
144
|
end
|
151
|
-
|
145
|
+
|
152
146
|
r[1] = Date.strptime(date,r1f)
|
153
147
|
r[0] = Date.strptime(date,'%B %d')
|
154
148
|
r[0] = Date.new(r[1].year,r[0].month,r[0].day)
|
155
149
|
end
|
156
150
|
elsif date.include?('/')
|
157
151
|
# "1/7/2012"
|
158
|
-
if date =~
|
152
|
+
if date =~ %r{\A[[:digit:]]+\s*/\s*[[:digit:]]+\s*/\s*[[:digit:]]+\z}
|
159
153
|
date = date.gsub(/\s+/,'')
|
160
|
-
|
154
|
+
|
161
155
|
r[0] = Date.strptime(date,'%m/%d/%Y')
|
162
156
|
r[1] = nil
|
163
157
|
else
|
@@ -167,13 +161,14 @@ module UncleKryon
|
|
167
161
|
r[0] = Date.new(r[1].year,r[0].month,r[0].day)
|
168
162
|
end
|
169
163
|
else
|
164
|
+
case date
|
170
165
|
# "April 11, 12, 2015"
|
171
|
-
|
166
|
+
when /\A[[:alpha:]]+\s*[[:digit:]]+\s*,\s*[[:digit:]]+\s*,\s*[[:digit:]]+\z/
|
172
167
|
r[1] = Date.strptime(date,'%B %d, %d, %Y')
|
173
168
|
r[0] = Date.strptime(date,'%B %d')
|
174
169
|
r[0] = Date.new(r[1].year,r[0].month,r[0].day)
|
175
170
|
# "March, 2014"
|
176
|
-
|
171
|
+
when /\A[[:alpha:]]+\s*,\s*[[:digit:]]+\z/
|
177
172
|
r[0] = Date.strptime(date,'%B, %Y')
|
178
173
|
r[1] = nil
|
179
174
|
else
|
@@ -185,228 +180,228 @@ module UncleKryon
|
|
185
180
|
Log.instance.fatal("Invalid Date: '#{date}'",error: e)
|
186
181
|
raise
|
187
182
|
end
|
188
|
-
|
183
|
+
|
189
184
|
r[0] = (!r[0].nil?) ? Util.format_date(r[0]) : ''
|
190
185
|
r[1] = (!r[1].nil?) ? Util.format_date(r[1]) : ''
|
191
|
-
|
186
|
+
|
192
187
|
return r
|
193
188
|
end
|
194
|
-
|
189
|
+
|
195
190
|
def parse_site(title=nil,url=nil,artist=nil)
|
196
|
-
@artist = artist unless artist.nil?
|
197
|
-
@title = title unless title.nil?
|
198
|
-
|
191
|
+
@artist = artist unless artist.nil?
|
192
|
+
@title = title unless title.nil?
|
193
|
+
|
199
194
|
@url = Util.empty_s?(url) ? self.class.get_kryon_year_url(@title) : url
|
200
|
-
|
201
|
-
raise ArgumentError,
|
202
|
-
raise ArgumentError,
|
203
|
-
raise ArgumentError,
|
204
|
-
|
195
|
+
|
196
|
+
raise ArgumentError,'Artist cannot be nil' if @artist.nil?
|
197
|
+
raise ArgumentError,'Title cannot be empty' if @title.nil? || (@title = @title.strip).empty?
|
198
|
+
raise ArgumentError,'URL cannot be empty' if @url.nil? || (@url = @url.strip).empty?
|
199
|
+
|
205
200
|
@release = @artist.releases[@title]
|
206
|
-
@trainers.load_file
|
207
|
-
|
201
|
+
@trainers.load_file
|
202
|
+
|
208
203
|
if @release.nil?
|
209
204
|
@release = ReleaseData.new
|
210
205
|
@release.mirrors = self.class.get_kryon_year_mirrors(@title)
|
211
206
|
@release.title = @title
|
212
207
|
@release.updated_on = @updated_on
|
213
208
|
@release.url = @url
|
214
|
-
|
209
|
+
|
215
210
|
@artist.releases[@title] = @release
|
216
211
|
end
|
217
|
-
|
218
|
-
doc = Nokogiri::HTML(
|
212
|
+
|
213
|
+
doc = Nokogiri::HTML(URI(@release.url).open,nil,'utf-8') # Force utf-8 encoding
|
219
214
|
row_pos = 1
|
220
215
|
rows = doc.css('table tr tr')
|
221
|
-
|
222
|
-
rows.each
|
216
|
+
|
217
|
+
rows.each do |row|
|
223
218
|
next if row.nil?
|
224
219
|
next if (cells = row.css('td')).nil?
|
225
|
-
|
220
|
+
|
226
221
|
album = AlbumData.new
|
227
222
|
album.updated_on = @updated_on
|
228
223
|
@exclude_album = false
|
229
|
-
|
224
|
+
|
230
225
|
# There is always a date cell
|
231
226
|
has_date_cell = parse_date_cell(cells,album)
|
232
|
-
|
227
|
+
|
233
228
|
# Sometimes there is not a topic, location, or language cell, but not all 3!
|
234
229
|
# - Put || last because of short-circuit ||!
|
235
230
|
# - For some reason, "or" does not work (even though it is supposed to be non-short-circuit)
|
236
231
|
has_other_cell = parse_topic_cell(cells,album)
|
237
232
|
has_other_cell = parse_location_cell(cells,album) || has_other_cell
|
238
233
|
has_other_cell = parse_language_cell(cells,album) || has_other_cell
|
239
|
-
|
234
|
+
|
240
235
|
if !has_date_cell || !has_other_cell || @exclude_album
|
241
236
|
# - If it doesn't have any cells, it is probably javascript or something else, so don't log it
|
242
237
|
# - If @exclude_album, then it has already been logged, so don't log it
|
243
238
|
if (!has_date_cell && has_other_cell) || (has_date_cell && !@exclude_album)
|
244
|
-
log.warn("Excluding album: #{row_pos},#{album.date_begin},#{album.date_end},#{album.title},"
|
245
|
-
|
239
|
+
log.warn("Excluding album: #{row_pos},#{album.date_begin},#{album.date_end},#{album.title}," \
|
240
|
+
"#{album.locations},#{album.languages}")
|
246
241
|
row_pos += 1
|
247
242
|
end
|
248
|
-
|
243
|
+
|
249
244
|
next
|
250
245
|
end
|
251
|
-
|
246
|
+
|
252
247
|
# Is it actually old or new?
|
253
248
|
if @artist.albums.key?(album.url) && album == @artist.albums[album.url]
|
254
249
|
album.updated_on = @artist.albums[album.url].updated_on
|
255
250
|
end
|
256
|
-
|
251
|
+
|
257
252
|
album.url = Util.fix_link(album.url)
|
258
|
-
|
253
|
+
|
259
254
|
@artist.albums[album.url] = album
|
260
|
-
|
255
|
+
|
261
256
|
if !@release.albums.include?(album.url)
|
262
257
|
@release.albums.push(album.url)
|
263
258
|
@release.updated_on = @updated_on
|
264
259
|
end
|
265
|
-
|
260
|
+
|
266
261
|
row_pos += 1
|
267
262
|
end
|
268
|
-
|
263
|
+
|
269
264
|
return @release
|
270
265
|
end
|
271
|
-
|
266
|
+
|
272
267
|
def parse_date_cell(cells,album)
|
273
268
|
# Get url from date because sometimes there is not a topic
|
274
|
-
|
269
|
+
|
275
270
|
return false if cells.length <= 1
|
276
271
|
return false if (cell = cells[1]).nil?
|
277
272
|
return false if (cell = cell.css('a')).nil?
|
278
273
|
return false if cell.length < 1
|
279
|
-
|
274
|
+
|
280
275
|
# For 2014 albums
|
281
276
|
cells = cell
|
282
277
|
cell = nil
|
283
|
-
|
278
|
+
|
284
279
|
cells.each do |c|
|
285
|
-
if !c.nil?
|
280
|
+
if !c.nil? && !Util.empty_s?(c.content) && !c['href'].nil?
|
286
281
|
cell = c
|
287
282
|
break
|
288
283
|
end
|
289
284
|
end
|
290
|
-
|
291
|
-
return false if cell.nil?
|
292
|
-
|
285
|
+
|
286
|
+
return false if cell.nil?
|
287
|
+
|
293
288
|
r_date = self.class.parse_kryon_date(Util.clean_data(cell.content),@title)
|
294
289
|
album.date_begin = r_date[0]
|
295
290
|
album.date_end = r_date[1]
|
296
291
|
album.url = Util.clean_link(@release.url,cell['href'])
|
297
|
-
|
298
|
-
return false if
|
292
|
+
|
293
|
+
return false if album.date_begin.empty? || album.url.empty?
|
299
294
|
return true
|
300
295
|
end
|
301
|
-
|
296
|
+
|
302
297
|
def parse_language_cell(cells,album)
|
303
298
|
return false if cells.length <= 4
|
304
299
|
return false if (cell = cells[4]).nil?
|
305
300
|
return false if (cell = cell.content).nil?
|
306
|
-
|
301
|
+
|
307
302
|
cell = Util.clean_data(cell)
|
308
303
|
# For the official site, they always have English, so add it if not present
|
309
304
|
album.languages = Iso.languages.find_by_kryon(cell,add_english: true)
|
310
|
-
|
311
|
-
return false if album.languages.nil?
|
305
|
+
|
306
|
+
return false if album.languages.nil? || album.languages.empty?
|
312
307
|
return true
|
313
308
|
end
|
314
|
-
|
309
|
+
|
315
310
|
def parse_location_cell(cells,album)
|
316
311
|
return false if cells.length <= 3
|
317
312
|
return false if (cell = cells[3]).nil?
|
318
313
|
return false if (cell = cell.content).nil?
|
319
314
|
return false if cell =~ /[[:space:]]*RADIO[[:space:]]+SHOW[[:space:]]*/ # 2014
|
320
|
-
return false if (cell = Util.clean_data(cell)).empty?
|
321
|
-
|
315
|
+
return false if (cell = Util.clean_data(cell)).empty?
|
316
|
+
|
322
317
|
album.locations = Iso.find_kryon_locations(cell)
|
323
|
-
|
324
|
-
return false if album.locations.nil?
|
325
|
-
|
318
|
+
|
319
|
+
return false if album.locations.nil? || album.locations.empty?
|
320
|
+
|
326
321
|
return true
|
327
322
|
end
|
328
|
-
|
323
|
+
|
329
324
|
def parse_topic_cell(cells,album)
|
330
325
|
return false if cells.length <= 2
|
331
326
|
return false if (cell = cells[2]).nil?
|
332
327
|
return false if (cell = cell.css('a')).nil?
|
333
328
|
return false if cell.length < 1
|
334
|
-
|
329
|
+
|
335
330
|
# For 2017 "San Jose, California (3)"
|
336
331
|
cells = cell
|
337
332
|
cell = nil
|
338
|
-
|
333
|
+
|
339
334
|
cells.each do |c|
|
340
|
-
if !c.nil?
|
335
|
+
if !c.nil? && !Util.empty_s?(c.content)
|
341
336
|
cell = c
|
342
337
|
break
|
343
338
|
end
|
344
339
|
end
|
345
|
-
|
346
|
-
return false if cell.nil?
|
347
|
-
|
340
|
+
|
341
|
+
return false if cell.nil?
|
342
|
+
|
348
343
|
album.title = Util.fix_shortwith_text(Util.clean_data(cell.content))
|
349
|
-
|
344
|
+
|
350
345
|
exclude_topics = /
|
351
346
|
GROUP[[:space:]]+PHOTO|
|
352
347
|
PLEASE[[:space:]]+READ
|
353
348
|
/ix
|
354
|
-
|
349
|
+
|
355
350
|
if album.title =~ exclude_topics
|
356
351
|
log.warn("Excluding album: Topic[#{album.title}]")
|
357
352
|
@exclude_album = true
|
358
353
|
return false
|
359
354
|
end
|
360
|
-
|
355
|
+
|
361
356
|
# Sometimes, the date cell's href is an image (See 2016 'Las Vegas, NV - "Numerology" - (3)')
|
362
357
|
good_urls = /
|
363
358
|
\.html?[[:space:]]*\z
|
364
359
|
/ix
|
365
|
-
|
360
|
+
|
366
361
|
date_url = album.url
|
367
362
|
topic_url = Util.clean_link(@release.url,cell['href'])
|
368
|
-
|
363
|
+
|
369
364
|
# Sometimes, the date cell's href is wrong (See 2016 '"Five Concepts for the New Human" (2)')
|
370
365
|
if album.url !~ good_urls || (!Util.empty_s?(topic_url) && date_url != topic_url)
|
371
366
|
album.url = topic_url
|
372
367
|
log.warn("Using topic cell's href for URL: #{File.basename(date_url)}=>#{File.basename(album.url)}")
|
373
|
-
|
368
|
+
|
374
369
|
if Util.empty_s?(album.url)
|
375
370
|
msg = "Date and topic cells' hrefs are empty: Topic[#{album.title}]"
|
376
|
-
|
377
|
-
if DevOpts.instance.dev?
|
371
|
+
|
372
|
+
if DevOpts.instance.dev?
|
378
373
|
raise msg
|
379
374
|
else
|
380
375
|
log.warn(msg)
|
381
376
|
end
|
382
|
-
|
377
|
+
|
383
378
|
return false
|
384
379
|
end
|
385
380
|
end
|
386
|
-
|
381
|
+
|
387
382
|
return false if album.title.empty?
|
388
383
|
return true
|
389
384
|
end
|
390
|
-
|
385
|
+
|
391
386
|
def self.fix_kryon_year_title(year)
|
392
387
|
year = '2002_05' if year == '2002-2005'
|
393
|
-
|
388
|
+
|
394
389
|
return year
|
395
390
|
end
|
396
|
-
|
391
|
+
|
397
392
|
def self.get_kryon_year_mirrors(year)
|
398
393
|
year = fix_kryon_year_title(year)
|
399
|
-
|
394
|
+
|
400
395
|
mirrors = {
|
401
396
|
'original' => "https://www.kryon.com/freeAudio_folder/#{year}_freeAudio.html"
|
402
397
|
}
|
403
|
-
|
398
|
+
|
404
399
|
return mirrors
|
405
400
|
end
|
406
|
-
|
401
|
+
|
407
402
|
def self.get_kryon_year_url(year,url_version=2)
|
408
403
|
year = fix_kryon_year_title(year)
|
409
|
-
|
404
|
+
|
410
405
|
return "https://www.kryon.com/freeAudio_folder/mobile_pages/#{year}_freeAudio_m.html"
|
411
406
|
end
|
412
407
|
end
|
data/lib/unclekryon/server.rb
CHANGED
@@ -1,29 +1,20 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
#--
|
6
5
|
# This file is part of UncleKryon-server.
|
7
|
-
# Copyright (c) 2017-
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation, either version 3 of the License, or
|
12
|
-
# (at your option) any later version.
|
13
|
-
#
|
14
|
-
# UncleKryon-server is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with UncleKryon-server. If not, see <https://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2017-2022 Jonathan Bradley Whited
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: GPL-3.0-or-later
|
21
9
|
#++
|
22
10
|
|
23
11
|
|
24
|
-
require 'bundler/setup'
|
25
|
-
|
26
12
|
module UncleKryon
|
27
13
|
class Server
|
14
|
+
# TODO: server
|
28
15
|
end
|
29
16
|
end
|
17
|
+
|
18
|
+
#if $PROGRAM_NAME == __FILE__
|
19
|
+
# # Test here.
|
20
|
+
#end
|