unclekryon 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -19
  3. data/Gemfile.lock +19 -23
  4. data/README.md +3 -2
  5. data/Rakefile +11 -30
  6. data/bin/unclekryon +4 -15
  7. data/hax/kryon.yaml +28 -0
  8. data/hax/kryon_aums_2002-2005.yaml +460 -0
  9. data/hax/kryon_aums_2006.yaml +601 -0
  10. data/hax/kryon_aums_2007.yaml +1024 -0
  11. data/hax/kryon_aums_2008.yaml +950 -0
  12. data/hax/kryon_aums_2009.yaml +496 -0
  13. data/hax/kryon_aums_2010.yaml +1443 -0
  14. data/hax/kryon_aums_2011.yaml +1458 -0
  15. data/hax/kryon_aums_2012.yaml +2123 -0
  16. data/hax/kryon_aums_2013.yaml +1647 -0
  17. data/hax/kryon_aums_2014.yaml +2478 -0
  18. data/hax/kryon_aums_2015.yaml +3386 -0
  19. data/hax/kryon_aums_2016.yaml +3476 -0
  20. data/hax/kryon_aums_2017.yaml +3712 -0
  21. data/hax/kryon_aums_2018.yaml +3654 -0
  22. data/lib/unclekryon.rb +165 -165
  23. data/lib/unclekryon/data/album_data.rb +74 -82
  24. data/lib/unclekryon/data/artist_data.rb +24 -36
  25. data/lib/unclekryon/data/artist_data_data.rb +29 -41
  26. data/lib/unclekryon/data/aum_data.rb +20 -32
  27. data/lib/unclekryon/data/base_data.rb +27 -39
  28. data/lib/unclekryon/data/pic_data.rb +25 -37
  29. data/lib/unclekryon/data/release_data.rb +14 -26
  30. data/lib/unclekryon/data/social_data.rb +6 -18
  31. data/lib/unclekryon/data/timespan_data.rb +16 -28
  32. data/lib/unclekryon/dev_opts.rb +7 -19
  33. data/lib/unclekryon/hacker.rb +119 -133
  34. data/lib/unclekryon/iso.rb +128 -138
  35. data/lib/unclekryon/iso/base_iso.rb +69 -81
  36. data/lib/unclekryon/iso/can_prov_terr.rb +34 -47
  37. data/lib/unclekryon/iso/country.rb +36 -49
  38. data/lib/unclekryon/iso/language.rb +86 -96
  39. data/lib/unclekryon/iso/region.rb +11 -25
  40. data/lib/unclekryon/iso/subregion.rb +11 -25
  41. data/lib/unclekryon/iso/usa_state.rb +28 -41
  42. data/lib/unclekryon/jsoner.rb +31 -50
  43. data/lib/unclekryon/log.rb +34 -46
  44. data/lib/unclekryon/parsers/kryon_aum_year_album_parser.rb +163 -167
  45. data/lib/unclekryon/parsers/kryon_aum_year_parser.rb +122 -127
  46. data/lib/unclekryon/server.rb +8 -17
  47. data/lib/unclekryon/trainer.rb +69 -83
  48. data/lib/unclekryon/uploader.rb +8 -17
  49. data/lib/unclekryon/util.rb +80 -92
  50. data/lib/unclekryon/version.rb +4 -16
  51. data/train/kryon.yaml +6077 -0
  52. data/unclekryon.gemspec +44 -42
  53. metadata +59 -16
@@ -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-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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
 
@@ -31,37 +19,37 @@ module UncleKryon
31
19
  attr_accessor :timespan
32
20
  attr_accessor :filesize
33
21
  attr_accessor :filename
34
-
22
+
35
23
  attr_accessor :url
36
24
  attr_accessor :mirrors
37
-
38
- def initialize()
25
+
26
+ def initialize
39
27
  super()
40
-
28
+
41
29
  @title = ''
42
30
  @subtitle = ''
43
31
  @languages = []
44
32
  @timespan = ''
45
33
  @filesize = ''
46
34
  @filename = ''
47
-
35
+
48
36
  @url = ''
49
37
  @mirrors = {}
50
38
  end
51
-
39
+
52
40
  # Excludes @updated_on
53
- def ==(y)
54
- return @title == y.title &&
55
- @subtitle == y.subtitle &&
56
- @languages == y.languages &&
57
- @timespan == y.timespan &&
58
- @filesize == y.filesize &&
59
- @filename == y.filename &&
60
- @url == y.url &&
61
- @mirrors == y.mirrors
41
+ def ==(other)
42
+ return @title == other.title &&
43
+ @subtitle == other.subtitle &&
44
+ @languages == other.languages &&
45
+ @timespan == other.timespan &&
46
+ @filesize == other.filesize &&
47
+ @filename == other.filename &&
48
+ @url == other.url &&
49
+ @mirrors == other.mirrors
62
50
  end
63
-
64
- def to_s()
51
+
52
+ def to_s
65
53
  s = ''
66
54
  s << ('%-40s' % [@title])
67
55
  s << (' | %30s' % [@subtitle])
@@ -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) 2018-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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) 2018-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: GPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -28,50 +16,50 @@ require 'unclekryon/util'
28
16
  module UncleKryon
29
17
  class BaseData
30
18
  attr_accessor :updated_on
31
-
32
- def initialize()
33
- update()
19
+
20
+ def initialize
21
+ update
34
22
  end
35
-
23
+
36
24
  def initialize_copy(original)
37
25
  super(original)
38
-
39
- @updated_on = @updated_on.clone()
26
+
27
+ @updated_on = @updated_on.clone
40
28
  end
41
-
42
- def update()
43
- @updated_on = Util.format_datetime(DateTime.now())
29
+
30
+ def update
31
+ @updated_on = Util.format_datetime(DateTime.now)
44
32
  return @updated_on
45
33
  end
46
-
47
- def max_updated_on()
34
+
35
+ def max_updated_on
48
36
  max = nil
49
-
37
+
50
38
  instance_variables.each do |iv|
51
- vuo = Util.parse_datetime_s(instance_variable_get(iv)) if iv.to_s() =~ /\A@updated_.+_on\z/
52
- max = vuo if max.nil?() || vuo > max
39
+ vuo = Util.parse_datetime_s(instance_variable_get(iv)) if iv.to_s =~ /\A@updated_.+_on\z/
40
+ max = vuo if max.nil? || vuo > max
53
41
  end
54
-
42
+
55
43
  return max
56
44
  end
57
-
45
+
58
46
  def self.max_updated_on(data)
59
47
  max = nil
60
-
48
+
61
49
  if data.is_a?(Hash)
62
- data.each() do |k,v|
50
+ data.each do |k,v|
63
51
  vuo = Util.parse_datetime_s(v.updated_on)
64
- max = vuo if max.nil?() || vuo > max
52
+ max = vuo if max.nil? || vuo > max
65
53
  end
66
54
  end
67
-
55
+
68
56
  return max
69
57
  end
70
-
71
- def max_updated_on_s()
72
- return Util.format_datetime(max_updated_on())
58
+
59
+ def max_updated_on_s
60
+ return Util.format_datetime(max_updated_on)
73
61
  end
74
-
62
+
75
63
  def self.max_updated_on_s(data)
76
64
  return Util.format_datetime(max_updated_on(data))
77
65
  end
@@ -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-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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
 
@@ -27,49 +15,49 @@ module UncleKryon
27
15
  class PicData < BaseData
28
16
  attr_accessor :name
29
17
  attr_accessor :filename
30
-
18
+
31
19
  attr_accessor :alt
32
20
  attr_accessor :caption
33
-
21
+
34
22
  attr_accessor :url
35
23
  attr_accessor :mirrors
36
-
37
- def initialize()
24
+
25
+ def initialize
38
26
  super()
39
-
27
+
40
28
  @name = ''
41
29
  @filename = ''
42
-
30
+
43
31
  @alt = ''
44
32
  @caption = ''
45
-
33
+
46
34
  @url = ''
47
35
  @mirrors = {}
48
36
  end
49
-
37
+
50
38
  # Excludes @updated_on
51
- def ==(y)
52
- return @name == y.name &&
53
- @filename == y.filename &&
54
- @alt == y.alt &&
55
- @caption == y.caption &&
56
- @url == y.url &&
57
- @mirrors == y.mirrors
39
+ def ==(other)
40
+ return @name == other.name &&
41
+ @filename == other.filename &&
42
+ @alt == other.alt &&
43
+ @caption == other.caption &&
44
+ @url == other.url &&
45
+ @mirrors == other.mirrors
58
46
  end
59
-
60
- def to_s()
61
- s = ''.dup()
62
-
63
- if @name.empty?() || @name.strip().empty?()
47
+
48
+ def to_s
49
+ s = ''.dup
50
+
51
+ if @name.empty? || @name.strip.empty?
64
52
  s << ('%-100s' % [@url])
65
53
  else
66
54
  s << ('%-30s' % [@name])
67
55
  s << (' | %30s' % [@filename]) unless @name == @filename
68
-
56
+
69
57
  s << (' | %30s' % [@alt]) unless @name == @alt
70
58
  s << (' | %60s' % [@caption])
71
59
  end
72
-
60
+
73
61
  return s
74
62
  end
75
63
  end
@@ -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-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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
 
@@ -26,31 +14,31 @@ require 'unclekryon/data/base_data'
26
14
  module UncleKryon
27
15
  class ReleaseData < BaseData
28
16
  attr_accessor :title
29
-
17
+
30
18
  attr_accessor :url
31
19
  attr_accessor :mirrors
32
-
20
+
33
21
  attr_accessor :albums
34
-
35
- def initialize()
22
+
23
+ def initialize
36
24
  super()
37
-
25
+
38
26
  @title = ''
39
-
27
+
40
28
  @url = ''
41
29
  @mirrors = {}
42
-
30
+
43
31
  @albums = []
44
32
  end
45
-
46
- def to_mini_s()
33
+
34
+ def to_mini_s
47
35
  return to_s(true)
48
36
  end
49
-
37
+
50
38
  def to_s(mini=false)
51
39
  s = ''
52
40
  s << ('%-10s' % [@title])
53
- s << (mini ? (' | %3d' % [@albums.length()]) : ("\n- " << @albums.join("\n- ")))
41
+ s << (mini ? (' | %3d' % [@albums.length]) : ("\n- " << @albums.join("\n- ")))
54
42
  return s
55
43
  end
56
44
  end
@@ -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) 2018-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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) 2018-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: GPL-3.0-or-later
21
9
  #++
22
10
 
23
11
 
@@ -28,10 +16,10 @@ module UncleKryon
28
16
  class SocialData
29
17
  attr_accessor :username
30
18
  attr_accessor :url
31
-
32
- def initialize()
19
+
20
+ def initialize
33
21
  super()
34
-
22
+
35
23
  @username = ''
36
24
  @url = ''
37
25
  end
@@ -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-2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # UncleKryon-server is free software: you can redistribute it and/or modify
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
 
@@ -30,28 +18,28 @@ module UncleKryon
30
18
  attr_accessor :hours
31
19
  attr_accessor :mins
32
20
  attr_accessor :secs
33
-
21
+
34
22
  def initialize(time=nil)
35
23
  @hours = 0
36
24
  @mins = 0
37
25
  @secs = 0
38
-
39
- if !time.nil?() && !(time = time.strip()).empty?()
26
+
27
+ if !time.nil? && !(time = time.strip).empty?
40
28
  time = time.gsub(/\A[^\(]+\(/,'') # "One hour 6 minutes - (66 minutes)"
41
29
  time = time.gsub(/[^[[:digit:]]\:\.]+/,'')
42
30
  a = time.split(/[\:\.]/)
43
-
31
+
44
32
  if a.length == 1
45
- @mins = a[0].to_i()
33
+ @mins = a[0].to_i
46
34
  elsif a.length == 2
47
- @mins = a[0].to_i()
48
- @secs = a[1].to_i()
35
+ @mins = a[0].to_i
36
+ @secs = a[1].to_i
49
37
  elsif a.length >= 3
50
- @hours = a[0].to_i()
51
- @mins = a[1].to_i()
52
- @secs = a[2].to_i()
38
+ @hours = a[0].to_i
39
+ @mins = a[1].to_i
40
+ @secs = a[2].to_i
53
41
  end
54
-
42
+
55
43
  if @secs >= 60
56
44
  @mins += (@secs / 60)
57
45
  @secs = @secs % 60
@@ -62,8 +50,8 @@ module UncleKryon
62
50
  end
63
51
  end
64
52
  end
65
-
66
- def to_s()
53
+
54
+ def to_s
67
55
  return "#{@hours}:#{@mins}:#{@secs}"
68
56
  end
69
57
  end