artbase 0.1.0 → 0.2.2

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.
data/LICENSE.md DELETED
@@ -1,116 +0,0 @@
1
- CC0 1.0 Universal
2
-
3
- Statement of Purpose
4
-
5
- The laws of most jurisdictions throughout the world automatically confer
6
- exclusive Copyright and Related Rights (defined below) upon the creator and
7
- subsequent owner(s) (each and all, an "owner") of an original work of
8
- authorship and/or a database (each, a "Work").
9
-
10
- Certain owners wish to permanently relinquish those rights to a Work for the
11
- purpose of contributing to a commons of creative, cultural and scientific
12
- works ("Commons") that the public can reliably and without fear of later
13
- claims of infringement build upon, modify, incorporate in other works, reuse
14
- and redistribute as freely as possible in any form whatsoever and for any
15
- purposes, including without limitation commercial purposes. These owners may
16
- contribute to the Commons to promote the ideal of a free culture and the
17
- further production of creative, cultural and scientific works, or to gain
18
- reputation or greater distribution for their Work in part through the use and
19
- efforts of others.
20
-
21
- For these and/or other purposes and motivations, and without any expectation
22
- of additional consideration or compensation, the person associating CC0 with a
23
- Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24
- and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25
- and publicly distribute the Work under its terms, with knowledge of his or her
26
- Copyright and Related Rights in the Work and the meaning and intended legal
27
- effect of CC0 on those rights.
28
-
29
- 1. Copyright and Related Rights. A Work made available under CC0 may be
30
- protected by copyright and related or neighboring rights ("Copyright and
31
- Related Rights"). Copyright and Related Rights include, but are not limited
32
- to, the following:
33
-
34
- i. the right to reproduce, adapt, distribute, perform, display, communicate,
35
- and translate a Work;
36
-
37
- ii. moral rights retained by the original author(s) and/or performer(s);
38
-
39
- iii. publicity and privacy rights pertaining to a person's image or likeness
40
- depicted in a Work;
41
-
42
- iv. rights protecting against unfair competition in regards to a Work,
43
- subject to the limitations in paragraph 4(a), below;
44
-
45
- v. rights protecting the extraction, dissemination, use and reuse of data in
46
- a Work;
47
-
48
- vi. database rights (such as those arising under Directive 96/9/EC of the
49
- European Parliament and of the Council of 11 March 1996 on the legal
50
- protection of databases, and under any national implementation thereof,
51
- including any amended or successor version of such directive); and
52
-
53
- vii. other similar, equivalent or corresponding rights throughout the world
54
- based on applicable law or treaty, and any national implementations thereof.
55
-
56
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58
- unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59
- and Related Rights and associated claims and causes of action, whether now
60
- known or unknown (including existing as well as future claims and causes of
61
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
62
- duration provided by applicable law or treaty (including future time
63
- extensions), (iii) in any current or future medium and for any number of
64
- copies, and (iv) for any purpose whatsoever, including without limitation
65
- commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66
- the Waiver for the benefit of each member of the public at large and to the
67
- detriment of Affirmer's heirs and successors, fully intending that such Waiver
68
- shall not be subject to revocation, rescission, cancellation, termination, or
69
- any other legal or equitable action to disrupt the quiet enjoyment of the Work
70
- by the public as contemplated by Affirmer's express Statement of Purpose.
71
-
72
- 3. Public License Fallback. Should any part of the Waiver for any reason be
73
- judged legally invalid or ineffective under applicable law, then the Waiver
74
- shall be preserved to the maximum extent permitted taking into account
75
- Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76
- is so judged Affirmer hereby grants to each affected person a royalty-free,
77
- non transferable, non sublicensable, non exclusive, irrevocable and
78
- unconditional license to exercise Affirmer's Copyright and Related Rights in
79
- the Work (i) in all territories worldwide, (ii) for the maximum duration
80
- provided by applicable law or treaty (including future time extensions), (iii)
81
- in any current or future medium and for any number of copies, and (iv) for any
82
- purpose whatsoever, including without limitation commercial, advertising or
83
- promotional purposes (the "License"). The License shall be deemed effective as
84
- of the date CC0 was applied by Affirmer to the Work. Should any part of the
85
- License for any reason be judged legally invalid or ineffective under
86
- applicable law, such partial invalidity or ineffectiveness shall not
87
- invalidate the remainder of the License, and in such case Affirmer hereby
88
- affirms that he or she will not (i) exercise any of his or her remaining
89
- Copyright and Related Rights in the Work or (ii) assert any associated claims
90
- and causes of action with respect to the Work, in either case contrary to
91
- Affirmer's express Statement of Purpose.
92
-
93
- 4. Limitations and Disclaimers.
94
-
95
- a. No trademark or patent rights held by Affirmer are waived, abandoned,
96
- surrendered, licensed or otherwise affected by this document.
97
-
98
- b. Affirmer offers the Work as-is and makes no representations or warranties
99
- of any kind concerning the Work, express, implied, statutory or otherwise,
100
- including without limitation warranties of title, merchantability, fitness
101
- for a particular purpose, non infringement, or the absence of latent or
102
- other defects, accuracy, or the present or absence of errors, whether or not
103
- discoverable, all to the greatest extent permissible under applicable law.
104
-
105
- c. Affirmer disclaims responsibility for clearing rights of other persons
106
- that may apply to the Work or any use thereof, including without limitation
107
- any person's Copyright and Related Rights in the Work. Further, Affirmer
108
- disclaims responsibility for obtaining any necessary consents, permissions
109
- or other rights required for any use of the Work.
110
-
111
- d. Affirmer understands and acknowledges that Creative Commons is not a
112
- party to this document and has no duty or obligation with respect to this
113
- CC0 or use of the Work.
114
-
115
- For more information, please see
116
- <http://creativecommons.org/publicdomain/zero/1.0/>
@@ -1,68 +0,0 @@
1
-
2
-
3
- PIXEL_OFFSETS['24x24'] = {
4
- ######################
5
- # 269x269 (24x24)
6
- # assume 11px per pixel 11x24 = 264 + 5 = 269
7
- #
8
- # e.g. 24.times {|i| puts "#{(5+i*11+5.0/24.0*i).to_i} => #{i}," }
9
- '269x269' => {
10
- 5 => 0,
11
- 16 => 1,
12
- 27 => 2,
13
- 38 => 3,
14
- 49 => 4,
15
- 61 => 5,
16
- 72 => 6,
17
- 83 => 7,
18
- 94 => 8,
19
- 105 => 9,
20
- 117 => 10,
21
- 128 => 11,
22
- 139 => 12,
23
- 150 => 13,
24
- 161 => 14,
25
- 173 => 15,
26
- 184 => 16,
27
- 195 => 17,
28
- 206 => 18,
29
- 217 => 19,
30
- 229 => 20,
31
- 240 => 21,
32
- 251 => 22,
33
- 262 => 23,
34
- },
35
-
36
-
37
- ######################
38
- # 512x512 (24x24)
39
- # assume 21px per pixel 21x24 = 504 + 8 = 512
40
- #
41
- # e.g. 24.times {|i| puts "#{(12+i*21+8.0/24.0*i).to_i} => #{i}," }
42
- '512x512' => {
43
- 12 => 0,
44
- 33 => 1,
45
- 54 => 2,
46
- 76 => 3,
47
- 97 => 4,
48
- 118 => 5,
49
- 140 => 6,
50
- 161 => 7,
51
- 182 => 8,
52
- 204 => 9,
53
- 225 => 10,
54
- 246 => 11,
55
- 268 => 12,
56
- 289 => 13,
57
- 310 => 14,
58
- 332 => 15,
59
- 353 => 16,
60
- 374 => 17,
61
- 396 => 18,
62
- 417 => 19,
63
- 438 => 20,
64
- 460 => 21,
65
- 481 => 22,
66
- 502 => 23,
67
- },
68
- }
@@ -1,43 +0,0 @@
1
-
2
- PIXEL_OFFSETS['32x32'] = {
3
- ######################
4
- # 320x320 (32x32)
5
- # assume 10px per pixel 10x32 = 320
6
- #
7
- # e.g. 32.times {|i| puts "#{5+i*10} => #{i}," }
8
- '320x320' => {
9
- 5 => 0,
10
- 15 => 1,
11
- 25 => 2,
12
- 35 => 3,
13
- 45 => 4,
14
- 55 => 5,
15
- 65 => 6,
16
- 75 => 7,
17
- 85 => 8,
18
- 95 => 9,
19
- 105 => 10,
20
- 115 => 11,
21
- 125 => 12,
22
- 135 => 13,
23
- 145 => 14,
24
- 155 => 15,
25
- 165 => 16,
26
- 175 => 17,
27
- 185 => 18,
28
- 195 => 19,
29
- 205 => 20,
30
- 215 => 21,
31
- 225 => 22,
32
- 235 => 23,
33
- 245 => 24,
34
- 255 => 25,
35
- 265 => 26,
36
- 275 => 27,
37
- 285 => 28,
38
- 295 => 29,
39
- 305 => 30,
40
- 315 => 31,
41
- },
42
- }
43
-
@@ -1,70 +0,0 @@
1
-
2
- PIXEL_OFFSETS['60x60'] = {
3
- '512x512' => {
4
- ###########
5
- # 512x512 (60x60)
6
- # assume 8px 60*8 = 480 + 32 = 512
7
- #
8
- # e.g. 60.times {|i| puts "#{(4+i*8+32.0/60.0*i).to_i} => #{i}," }
9
- 4 => 0,
10
- 12 => 1,
11
- 21 => 2,
12
- 29 => 3,
13
- 38 => 4,
14
- 46 => 5,
15
- 55 => 6,
16
- 63 => 7,
17
- 72 => 8,
18
- 80 => 9,
19
- 89 => 10,
20
- 97 => 11,
21
- 106 => 12,
22
- 114 => 13,
23
- 123 => 14,
24
- 132 => 15,
25
- 140 => 16,
26
- 149 => 17,
27
- 157 => 18,
28
- 166 => 19,
29
- 174 => 20,
30
- 183 => 21,
31
- 191 => 22,
32
- 200 => 23,
33
- 208 => 24,
34
- 217 => 25,
35
- 225 => 26,
36
- 234 => 27,
37
- 242 => 28,
38
- 251 => 29,
39
- 260 => 30,
40
- 268 => 31,
41
- 277 => 32,
42
- 285 => 33,
43
- 294 => 34,
44
- 302 => 35,
45
- 311 => 36,
46
- 319 => 37,
47
- 328 => 38,
48
- 336 => 39,
49
- 345 => 40,
50
- 353 => 41,
51
- 362 => 42,
52
- 370 => 43,
53
- 379 => 44,
54
- 388 => 45,
55
- 396 => 46,
56
- 405 => 47,
57
- 413 => 48,
58
- 422 => 49,
59
- 430 => 50,
60
- 439 => 51,
61
- 447 => 52,
62
- 456 => 53,
63
- 464 => 54,
64
- 473 => 55,
65
- 481 => 56,
66
- 490 => 57,
67
- 498 => 58,
68
- 507 => 59,
69
- },
70
- }
@@ -1,90 +0,0 @@
1
-
2
- PIXEL_OFFSETS['80x80'] = {
3
- '512x512' => {
4
- ###########
5
- # 512x512 (80x80)
6
- # assume 6px 80*6 = 480 + 32 = 512
7
- #
8
- # e.g. 80.times {|i| puts "#{(3+i*6+32.0/80.0*i).to_i} => #{i}," }
9
- 3 => 0,
10
- 9 => 1,
11
- 15 => 2,
12
- 22 => 3,
13
- 28 => 4,
14
- 35 => 5,
15
- 41 => 6,
16
- 47 => 7,
17
- 54 => 8,
18
- 60 => 9,
19
- 67 => 10,
20
- 73 => 11,
21
- 79 => 12,
22
- 86 => 13,
23
- 92 => 14,
24
- 99 => 15,
25
- 105 => 16,
26
- 111 => 17,
27
- 118 => 18,
28
- 124 => 19,
29
- 131 => 20,
30
- 137 => 21,
31
- 143 => 22,
32
- 150 => 23,
33
- 156 => 24,
34
- 163 => 25,
35
- 169 => 26,
36
- 175 => 27,
37
- 182 => 28,
38
- 188 => 29,
39
- 195 => 30,
40
- 201 => 31,
41
- 207 => 32,
42
- 214 => 33,
43
- 220 => 34,
44
- 227 => 35,
45
- 233 => 36,
46
- 239 => 37,
47
- 246 => 38,
48
- 252 => 39,
49
- 259 => 40,
50
- 265 => 41,
51
- 271 => 42,
52
- 278 => 43,
53
- 284 => 44,
54
- 291 => 45,
55
- 297 => 46,
56
- 303 => 47,
57
- 310 => 48,
58
- 316 => 49,
59
- 323 => 50,
60
- 329 => 51,
61
- 335 => 52,
62
- 342 => 53,
63
- 348 => 54,
64
- 355 => 55,
65
- 361 => 56,
66
- 367 => 57,
67
- 374 => 58,
68
- 380 => 59,
69
- 387 => 60,
70
- 393 => 61,
71
- 399 => 62,
72
- 406 => 63,
73
- 412 => 64,
74
- 419 => 65,
75
- 425 => 66,
76
- 431 => 67,
77
- 438 => 68,
78
- 444 => 69,
79
- 451 => 70,
80
- 457 => 71,
81
- 463 => 72,
82
- 470 => 73,
83
- 476 => 74,
84
- 483 => 75,
85
- 489 => 76,
86
- 495 => 77,
87
- 502 => 78,
88
- 508 => 79,
89
- }
90
- }
@@ -1,144 +0,0 @@
1
-
2
- module OpenSea
3
-
4
- #############
5
- # read meta data into struct
6
-
7
- class Meta
8
- def self.read( path )
9
- txt = File.open( path, 'r:utf-8' ) { |f| f.read }
10
- data = JSON.parse( txt )
11
- new( data )
12
- end
13
-
14
-
15
- def initialize( data )
16
- @data = data
17
-
18
- assets = @data['assets']
19
- if assets.size != 1
20
- puts "!! error - expected one asset per file only - got #{assets.size} - sorry"
21
- exit 1
22
- end
23
-
24
- @asset = assets[0]
25
- end
26
-
27
- def name
28
- @name ||= _normalize( @asset['name'] )
29
- end
30
-
31
- def description
32
- @description ||= _normalize( @asset['description'] )
33
- end
34
-
35
- ## note: auto-convert "" (empty string) to nil
36
- def image_original_url() _blank( @asset['image_original_url'] ); end
37
- def image_url() _blank( @asset['image_url'] ); end
38
-
39
-
40
- def token_id() @asset['token_id']; end ## note: keep id as string as is - why? why not?
41
-
42
-
43
- def traits
44
- @traits ||= begin
45
- traits = []
46
- ## keep traits as (simple)
47
- ## ordered array of pairs for now
48
- ##
49
- ## in a step two make lookup via hash table
50
- ## or such easier / "automagic"
51
-
52
- @asset[ 'traits' ].each do |t|
53
- trait_type = t['trait_type'].strip
54
- trait_value = t['value'].strip
55
- traits << [trait_type, trait_value]
56
- end
57
-
58
- traits
59
- end
60
- end
61
-
62
-
63
-
64
- ### "private" convenience / helper methods
65
- def _normalize( str )
66
- return if str.nil? ## check: check for nil - why? why not?
67
-
68
- ## normalize string
69
- ## remove leading and trailing spaces
70
- ## collapse two and more spaces into one
71
- ## change unicode space to ascii
72
- str = str.gsub( "\u{00a0}", ' ' )
73
- str = str.strip.gsub( /[ ]{2,}/, ' ' )
74
- str
75
- end
76
-
77
- def _blank( o ) ## auto-convert "" (empty string) into nil
78
- if o && o.strip.empty?
79
- nil
80
- else
81
- o
82
- end
83
- end
84
- end # class Meta
85
-
86
-
87
-
88
- BASE = 'https://api.opensea.io/api/v1/assets?collection={collection}&order_direction=asc&offset={offset}&limit=1'
89
-
90
- ## todo/check: rename to query or search or such - why? why not?
91
- ##
92
- ## add self.collect( collection, offset: 0 ) helper or such - why? why not?
93
- def self.assets( collection:, offset: 0 )
94
- src = BASE.sub( '{collection}', collection ).
95
- sub( '{offset}', offset.to_s )
96
-
97
- call( src )
98
- end
99
-
100
-
101
- def self.call( src ) ## get response as (parsed) json (hash table)
102
- uri = URI.parse( src )
103
-
104
- http = Net::HTTP.new( uri.host, uri.port )
105
-
106
- puts "[debug] GET #{uri.request_uri} uri=#{uri}"
107
-
108
- headers = {
109
- 'User-Agent' => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
110
- #'User-Agent' => "ruby v#{RUBY_VERSION}",
111
- }
112
-
113
-
114
- request = Net::HTTP::Get.new( uri.request_uri, headers )
115
- if uri.instance_of? URI::HTTPS
116
- http.use_ssl = true
117
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
118
- end
119
-
120
- response = http.request( request )
121
-
122
- if response.code == '200'
123
- puts "#{response.code} #{response.message} - content_type: #{response.content_type}, content_length: #{response.content_length}"
124
-
125
- text = response.body.to_s
126
- text = text.force_encoding( Encoding::UTF_8 )
127
-
128
- data = JSON.parse( text )
129
- data
130
- else
131
- puts "!! ERROR:"
132
- puts "#{response.code} #{response.message}"
133
- exit 1
134
- end
135
- end
136
- end # module OpenSea
137
-
138
-
139
-
140
-
141
- #####
142
- # add convenience alias
143
- Opensea = OpenSea
144
-