unclekryon 0.4.10 → 0.4.11

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.
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
 
@@ -32,115 +20,119 @@ module UncleKryon
32
20
  attr_accessor :title
33
21
  attr_accessor :locations
34
22
  attr_accessor :languages
35
-
23
+
36
24
  attr_accessor :url
37
25
  attr_accessor :mirrors
38
-
26
+
39
27
  attr_accessor :desc
40
-
28
+
41
29
  attr_accessor :pics
42
30
  attr_accessor :aums
43
31
  attr_accessor :scrolls
44
32
  attr_accessor :visions
45
-
33
+
46
34
  attr_accessor :dump
47
-
48
- def initialize()
35
+
36
+ def initialize
49
37
  super()
50
-
38
+
51
39
  @date_begin = ''
52
40
  @date_end = ''
53
41
  @title = ''
54
42
  @locations = []
55
43
  @languages = []
56
-
44
+
57
45
  @url = ''
58
46
  @mirrors = {}
59
-
47
+
60
48
  @desc = ''
61
-
49
+
62
50
  @pics = {}
63
51
  @aums = {}
64
52
  @scrolls = {}
65
53
  @visions = {}
66
-
54
+
67
55
  @dump = []
68
56
  end
69
-
57
+
70
58
  def initialize_copy(original)
71
59
  super(original)
72
-
73
- @date_begin = @date_begin.clone()
74
- @date_end = @date_end.clone()
75
- @title = @title.clone()
76
- @locations = @locations.clone()
77
- @languages = @languages.clone()
78
-
79
- @url = @url.clone()
80
- @mirrors = @mirrors.clone()
81
-
82
- @desc = @desc.clone()
83
-
84
- @pics = @pics.clone()
85
- @aums = @aums.clone()
86
- @scrolls = @scrolls.clone()
87
- @visions = @visions.clone()
88
-
89
- @dump = @dump.clone()
60
+
61
+ @date_begin = @date_begin.clone
62
+ @date_end = @date_end.clone
63
+ @title = @title.clone
64
+ @locations = @locations.clone
65
+ @languages = @languages.clone
66
+
67
+ @url = @url.clone
68
+ @mirrors = @mirrors.clone
69
+
70
+ @desc = @desc.clone
71
+
72
+ @pics = @pics.clone
73
+ @aums = @aums.clone
74
+ @scrolls = @scrolls.clone
75
+ @visions = @visions.clone
76
+
77
+ @dump = @dump.clone
90
78
  end
91
-
92
- def set_if_not_empty!(album)
79
+
80
+ def update_if_not_empty!(album)
93
81
  @date_begin = album.date_begin unless Util.empty_s?(album.date_begin)
94
82
  @date_end = album.date_end unless Util.empty_s?(album.date_end)
95
83
  @title = album.title unless Util.empty_s?(album.title)
96
- @locations |= album.locations unless album.locations.nil?()
97
- @languages |= album.languages unless album.languages.nil?()
98
-
84
+ @locations |= album.locations unless album.locations.nil?
85
+ @languages |= album.languages unless album.languages.nil?
86
+
99
87
  @desc = album.desc unless Util.empty_s?(album.desc)
100
-
101
- @pics |= album.pics unless album.pics.nil?()
102
- @aums |= album.aums unless album.aums.nil?()
103
- @scrolls |= album.scrolls unless album.scrolls.nil?()
104
- @visions |= album.visions unless album.visions.nil?()
105
-
106
- @dump |= album.dump unless album.dump.nil?()
88
+
89
+ @pics |= album.pics unless album.pics.nil?
90
+ @aums |= album.aums unless album.aums.nil?
91
+ @scrolls |= album.scrolls unless album.scrolls.nil?
92
+ @visions |= album.visions unless album.visions.nil?
93
+
94
+ @dump |= album.dump unless album.dump.nil?
107
95
  end
108
-
96
+
109
97
  # Excludes @updated_on and @dump
110
- def ==(y)
111
- return @date_begin == y.date_begin &&
112
- @date_end == y.date_end &&
113
- @title == y.title &&
114
- @locations == y.locations &&
115
- @languages == y.languages &&
116
- @url == y.url &&
117
- @mirrors == y.mirrors &&
118
- @desc == y.desc &&
119
- @pics == y.pics &&
120
- @aums == y.aums &&
121
- @scrolls == y.scrolls &&
122
- @visions == y.visions
98
+ def ==(other)
99
+ return @date_begin == other.date_begin &&
100
+ @date_end == other.date_end &&
101
+ @title == other.title &&
102
+ @locations == other.locations &&
103
+ @languages == other.languages &&
104
+ @url == other.url &&
105
+ @mirrors == other.mirrors &&
106
+ @desc == other.desc &&
107
+ @pics == other.pics &&
108
+ @aums == other.aums &&
109
+ @scrolls == other.scrolls &&
110
+ @visions == other.visions
123
111
  end
124
-
125
- def to_mini_s()
112
+
113
+ def to_mini_s
126
114
  return to_s(true)
127
115
  end
128
-
116
+
129
117
  def to_s(mini=false)
130
118
  s = ''
131
119
  s << ('%-10s=>%-10s' % [@date_begin,@date_end])
132
120
  s << (' | %60s' % [@title])
133
121
  s << (' | %25s' % [@locations.join(';')])
134
122
  s << (' | %10s' % [@languages.join(';')])
135
-
123
+
136
124
  s << "\n- #{@desc}" unless mini
137
-
138
- #s << (mini ? (' | pics:%3d' % [@pics.length()]) : ("\n- Pics:\n - " << @pics.join("\n - ")))
139
- #s << (mini ? (' | aums:%3d' % [@aums.length()]) : ("\n- Aums:\n - " << @aums.join("\n - ")))
140
- #s << (mini ? (' | scrolls:%3d' % [@scrolls.length()]) : ("\n- Scrolls:\n - " << @scrolls.join("\n - ")))
141
- #s << (mini ? (' | visions:%3d' % [@visions.length()]) : ("\n- Visions:\n - " << @visions.join("\n - ")))
142
-
143
- s << (mini ? (' | dump:%3d' % [@dump.length()]) : ("\n- Dump:\n - " << @dump.join("\n - ")))
125
+
126
+ #s << (mini ? (' | pics:%3d' % [@pics.length()]) :
127
+ # ("\n- Pics:\n - " << @pics.join("\n - ")))
128
+ #s << (mini ? (' | aums:%3d' % [@aums.length()]) :
129
+ # ("\n- Aums:\n - " << @aums.join("\n - ")))
130
+ #s << (mini ? (' | scrolls:%3d' % [@scrolls.length()]) :
131
+ # ("\n- Scrolls:\n - " << @scrolls.join("\n - ")))
132
+ #s << (mini ? (' | visions:%3d' % [@visions.length()]) :
133
+ # ("\n- Visions:\n - " << @visions.join("\n - ")))
134
+
135
+ s << (mini ? (' | dump:%3d' % [@dump.length]) : ("\n- Dump:\n - " << @dump.join("\n - ")))
144
136
  return s
145
137
  end
146
138
  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
 
@@ -31,69 +19,69 @@ require 'unclekryon/data/social_data'
31
19
  module UncleKryon
32
20
  class ArtistData < BaseData
33
21
  ID = 'Artist'
34
-
22
+
35
23
  attr_accessor :updated_releases_on
36
24
  attr_accessor :updated_albums_on
37
25
  attr_accessor :updated_aums_on
38
26
  attr_accessor :updated_scrolls_on
39
27
  attr_accessor :updated_visions_on
40
28
  attr_accessor :updated_pics_on
41
-
29
+
42
30
  attr_accessor :id
43
31
  attr_accessor :name
44
32
  attr_accessor :long_name
45
33
  attr_accessor :desc
46
-
34
+
47
35
  attr_accessor :url
48
36
  attr_accessor :mirrors
49
-
37
+
50
38
  attr_accessor :facebook
51
39
  attr_accessor :twitter
52
40
  attr_accessor :youtube
53
-
54
- def initialize()
41
+
42
+ def initialize
55
43
  super()
56
-
44
+
57
45
  @updated_releases_on = ''
58
46
  @updated_albums_on = ''
59
47
  @updated_aums_on = ''
60
48
  @updated_scrolls_on = ''
61
49
  @updated_visions_on = ''
62
50
  @updated_pics_on = ''
63
-
51
+
64
52
  @id = ''
65
53
  @name = ''
66
54
  @long_name = ''
67
55
  @desc = ''
68
-
56
+
69
57
  @url = ''
70
58
  @mirrors = {}
71
-
72
- @facebook = SocialData.new()
73
- @twitter = SocialData.new()
74
- @youtube = SocialData.new()
59
+
60
+ @facebook = SocialData.new
61
+ @twitter = SocialData.new
62
+ @youtube = SocialData.new
75
63
  end
76
-
64
+
77
65
  def self.load_file(filepath)
78
66
  y = YAML.load_file(filepath)
79
67
  artist = y[ID]
80
68
  return artist
81
69
  end
82
-
70
+
83
71
  def save_to_file(filepath,**options)
84
- raise "Empty filepath: #{filepath}" if filepath.nil?() || (filepath = filepath.strip()).empty?()
85
-
72
+ raise "Empty filepath: #{filepath}" if filepath.nil? || (filepath = filepath.strip).empty?
73
+
86
74
  Util.mk_dirs_from_filepath(filepath)
87
75
  File.open(filepath,'w') do |f|
88
- artist = {ID=>self}
76
+ artist = {ID => self}
89
77
  YAML.dump(artist,f)
90
78
  end
91
79
  end
92
-
93
- def to_mini_s()
80
+
81
+ def to_mini_s
94
82
  return to_s(true)
95
83
  end
96
-
84
+
97
85
  def to_s(mini=false)
98
86
  s = ''
99
87
  s << ('%-5s' % [@id])
@@ -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
 
@@ -43,17 +31,17 @@ module UncleKryon
43
31
  SCROLLS_ID = 'Scrolls'
44
32
  VISIONS_ID = 'Visions'
45
33
  PICS_ID = 'Pics'
46
-
34
+
47
35
  attr_accessor :releases
48
36
  attr_accessor :albums
49
37
  #attr_accessor :aums
50
38
  #attr_accessor :scrolls
51
39
  #attr_accessor :visions
52
40
  #attr_accessor :pics
53
-
54
- def initialize()
41
+
42
+ def initialize
55
43
  super()
56
-
44
+
57
45
  @releases = {}
58
46
  @albums = {}
59
47
  #@aums = {}
@@ -61,12 +49,12 @@ module UncleKryon
61
49
  #@visions = {}
62
50
  #@pics = {}
63
51
  end
64
-
52
+
65
53
  def self.load_file(filepath)
66
54
  filedata = YAML.load_file(filepath) if File.exist?(filepath)
67
55
  filedata = {} if !filedata
68
-
69
- artist = ArtistDataData.new()
56
+
57
+ artist = ArtistDataData.new
70
58
  Util.hash_def(filedata,[ID],{})
71
59
  artist.releases = Util.hash_def(filedata,[ID,RELEASES_ID],artist.releases)
72
60
  artist.albums = Util.hash_def(filedata,[ID,ALBUMS_ID],artist.albums)
@@ -74,28 +62,28 @@ module UncleKryon
74
62
  #artist.scrolls = Util.hash_def(filedata,[ID,SCROLLS_ID],artist.scrolls)
75
63
  #artist.visions = Util.hash_def(filedata,[ID,VISIONS_ID],artist.visions)
76
64
  #artist.pics = Util.hash_def(filedata,[ID,PICS_ID],artist.pics)
77
-
65
+
78
66
  return artist
79
67
  end
80
-
68
+
81
69
  def save_to_file(filepath,**options)
82
- raise "Empty filepath: #{filepath}" if filepath.nil?() || (filepath = filepath.strip()).empty?()
83
-
84
- filedata = {ID=>{}}
70
+ raise "Empty filepath: #{filepath}" if filepath.nil? || (filepath = filepath.strip).empty?
71
+
72
+ filedata = {ID => {}}
85
73
  filedata[ID][RELEASES_ID] = @releases
86
74
  filedata[ID][ALBUMS_ID] = @albums
87
75
  #filedata[ID][AUMS_ID] = @aums
88
76
  #filedata[ID][SCROLLS_ID] = @scrolls
89
77
  #filedata[ID][VISIONS_ID] = @visions
90
78
  #filedata[ID][PICS_ID] = @pics
91
-
79
+
92
80
  Util.mk_dirs_from_filepath(filepath)
93
81
  File.open(filepath,'w') do |f|
94
82
  YAML.dump(filedata,f)
95
83
  end
96
84
  end
97
-
98
- def max_updated_on()
85
+
86
+ def max_updated_on
99
87
  max = nil
100
88
  max = Util.safe_max(max,BaseData.max_updated_on(@releases))
101
89
  max = Util.safe_max(max,BaseData.max_updated_on(@albums))
@@ -103,26 +91,26 @@ module UncleKryon
103
91
  #max = Util.safe_max(max,BaseData.max_updated_on(@scrolls))
104
92
  #max = Util.safe_max(max,BaseData.max_updated_on(@visions))
105
93
  #max = Util.safe_max(max,BaseData.max_updated_on(@pics))
106
-
94
+
107
95
  return Util.format_datetime(max)
108
96
  end
109
-
110
- def to_mini_s()
97
+
98
+ def to_mini_s
111
99
  return to_s(true)
112
100
  end
113
-
101
+
114
102
  def to_s(mini=false)
115
103
  s = ''
116
-
104
+
117
105
  s << "- Releases:\n"
118
- @releases.each() do |k,v|
119
- s << " - " << v.to_s(mini).gsub("\n","\n ") << "\n"
106
+ @releases.each do |k,v|
107
+ s << ' - ' << v.to_s(mini).gsub("\n","\n ") << "\n"
120
108
  end
121
109
  s << "- Albums:\n"
122
- @albums.each() do |k,v|
123
- s << " - " << v.to_s(mini).gsub("\n","\n ") << "\n"
110
+ @albums.each do |k,v|
111
+ s << ' - ' << v.to_s(mini).gsub("\n","\n ") << "\n"
124
112
  end
125
-
113
+
126
114
  #s << "- Aums:\n"
127
115
  #@aums.each() do |k,v|
128
116
  # s << " - #{v.to_s()}\n"
@@ -139,7 +127,7 @@ module UncleKryon
139
127
  #@pics.each() do |k,v|
140
128
  # s << " - #{v.to_s()}\n"
141
129
  #end
142
-
130
+
143
131
  return s
144
132
  end
145
133
  end