artbase 0.0.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -3
- data/Manifest.txt +12 -0
- data/README.md +272 -26
- data/Rakefile +40 -29
- data/bin/artbase +17 -0
- data/lib/artbase/attributes.rb +83 -0
- data/lib/artbase/collection/base.rb +306 -0
- data/lib/artbase/collection/image.rb +39 -0
- data/lib/artbase/collection/opensea.rb +297 -0
- data/lib/artbase/collection/token.rb +372 -0
- data/lib/artbase/collection.rb +12 -0
- data/lib/artbase/helper.rb +169 -0
- data/lib/artbase/image/sample.rb +31 -0
- data/lib/artbase/image.rb +31 -0
- data/lib/artbase/retry.rb +41 -0
- data/lib/artbase/tool.rb +185 -0
- data/lib/artbase/version.rb +21 -22
- data/lib/artbase.rb +78 -9
- metadata +62 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 549b31d6f628fcb714c22fd03f179b75fd9b99e9c2bbe8532b1e79660e4f1ade
|
4
|
+
data.tar.gz: aadb6b67430375da20a83e94362562405dfca370dac2b8cfe514086a926ff2df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d1a745322df0250841c03975135d35f0f4ab4a9b8258e36482258e14b1847cece236b09755fd8962b6e942b21ed1ee5b28449c0d0b4d32f9f3c7c08e508533
|
7
|
+
data.tar.gz: 735c9079a101dd5aea55d5cb8458256082864e07bcaef81dff178cdeabb583df381ff9880d6aca7871c094a7f529342a9a206f4a4d877efe9c9b6b6b2600c27f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
### 0.0.1 / 2018-10-18
|
2
|
-
|
3
|
-
* Everything is new. First release
|
1
|
+
### 0.0.1 / 2018-10-18
|
2
|
+
|
3
|
+
* Everything is new. First release
|
data/Manifest.txt
CHANGED
@@ -2,5 +2,17 @@ CHANGELOG.md
|
|
2
2
|
Manifest.txt
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
|
+
bin/artbase
|
5
6
|
lib/artbase.rb
|
7
|
+
lib/artbase/attributes.rb
|
8
|
+
lib/artbase/collection.rb
|
9
|
+
lib/artbase/collection/base.rb
|
10
|
+
lib/artbase/collection/image.rb
|
11
|
+
lib/artbase/collection/opensea.rb
|
12
|
+
lib/artbase/collection/token.rb
|
13
|
+
lib/artbase/helper.rb
|
14
|
+
lib/artbase/image.rb
|
15
|
+
lib/artbase/image/sample.rb
|
16
|
+
lib/artbase/retry.rb
|
17
|
+
lib/artbase/tool.rb
|
6
18
|
lib/artbase/version.rb
|
data/README.md
CHANGED
@@ -1,26 +1,272 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
artbase
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
# artbase ("right-clicker") command line tool & scripts - download complete pixel art collections - yes, you can! - automate "right-click 'n' save" and much more
|
2
|
+
|
3
|
+
* home :: [github.com/pixelartexchange/artbase](https://github.com/pixelartexchange/artbase)
|
4
|
+
* bugs :: [github.com/pixelartexchange/artbase/issues](https://github.com/pixelartexchange/artbase/issues)
|
5
|
+
* gem :: [rubygems.org/gems/artbase](https://rubygems.org/gems/artbase)
|
6
|
+
* rdoc :: [rubydoc.info/gems/artbase](http://rubydoc.info/gems/artbase)
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
|
13
|
+
Note: The artbase is alpha - it's still the early days - it's a work-in-progress.
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
Let's try the 100 Blocky Doge (60x60) collection.
|
19
|
+
|
20
|
+
|
21
|
+
### Step 0 - Collection Configuration Script
|
22
|
+
|
23
|
+
Create a directory with the collection slug (e.g. `blockydoge`)
|
24
|
+
matching the OpenSea collection slug
|
25
|
+
and add a config script - `blockydoge/config.rb`:
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
COLLECTION = Collection.new(
|
29
|
+
|
30
|
+
'blockydoge', # opensea collection slug
|
31
|
+
100, # number of items
|
32
|
+
|
33
|
+
format: '60x60', # original pixel format
|
34
|
+
source: '512x512', # "big" source pixel format for
|
35
|
+
# downloaded image referenced in meta data
|
36
|
+
|
37
|
+
#####
|
38
|
+
# "automagically" get the id from the meta data name field
|
39
|
+
# via a "one-off / custom / hand-written" regex
|
40
|
+
# e.g. Blocky Doge #1 => 1
|
41
|
+
meta_slugify: /^Blocky Doge #(?<num>[0-9]+)$/,
|
42
|
+
)
|
43
|
+
```
|
44
|
+
|
45
|
+
Sorry for the "magic" config format for now -
|
46
|
+
see the [**artbase.sandbox**](https://github.com/pixelartexchange/artbase.sandbox) for many more "real-world" examples.
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
That's it now you can:
|
53
|
+
|
54
|
+
- Download all meta data files via the OpenSea API
|
55
|
+
- Download all referenced images in the meta data file
|
56
|
+
- Pixelate all downloaded images from the source format (e.g. 512x512) to the original format (e.g. 60x60)
|
57
|
+
- Generate an all-in-one composite with the pixelated images
|
58
|
+
- Export all meta data attributes / traits to an all-in-one datafile in the comma-separated-values (.csv) format
|
59
|
+
|
60
|
+
|
61
|
+
### Download all meta data files via the OpenSea API
|
62
|
+
|
63
|
+
Let's try:
|
64
|
+
|
65
|
+
```
|
66
|
+
$ artbase blockydoge meta
|
67
|
+
```
|
68
|
+
|
69
|
+
Note: All token meta data files get stored by convention in `blockydoge/token`.
|
70
|
+
Resulting in a file tree like:
|
71
|
+
|
72
|
+
```
|
73
|
+
blockydoge/token/
|
74
|
+
0.json
|
75
|
+
1.json
|
76
|
+
2.json
|
77
|
+
3.json
|
78
|
+
4.json
|
79
|
+
5.json
|
80
|
+
6.json
|
81
|
+
7.json
|
82
|
+
8.json
|
83
|
+
9.json
|
84
|
+
10.json
|
85
|
+
11.json
|
86
|
+
12.json
|
87
|
+
...
|
88
|
+
```
|
89
|
+
|
90
|
+
Example - `blockydoge/token/0.json`:
|
91
|
+
|
92
|
+
``` json
|
93
|
+
{
|
94
|
+
"id": 52224520,
|
95
|
+
"token_id": "154226446513437...7290852067901441",
|
96
|
+
"image_url": "https://lh3.googleusercontent.com/fIQQ0A7...gTlbgMTQ",
|
97
|
+
"image_preview_url": "https://lh3.googleusercontent.com/fIQQ0A7...gTlbgMTQ=s250",
|
98
|
+
"image_thumbnail_url": "https://lh3.googleusercontent.com/fIQQ0A7...gTlbgMTQ=s128",
|
99
|
+
"image_original_url": null,
|
100
|
+
"name": "Blocky Doge #1",
|
101
|
+
"description": "Blocky Doge ... 100 unique pixelated Doge avatars...",
|
102
|
+
|
103
|
+
...
|
104
|
+
|
105
|
+
"traits": [
|
106
|
+
{ "trait_type": "Fur", "value": "Red Fur", ... },
|
107
|
+
{ "trait_type": "Hat", "value": "Pink Party Hat", ... },
|
108
|
+
{ "trait_type": "Expression", "value": "Smiley", ... },
|
109
|
+
],
|
110
|
+
|
111
|
+
...
|
112
|
+
}
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
### Download all referenced images in the token meta data file
|
118
|
+
|
119
|
+
Let's try:
|
120
|
+
|
121
|
+
```
|
122
|
+
$ artbase blockydoge img
|
123
|
+
```
|
124
|
+
|
125
|
+
Note: All referenced images (in the source format e.g. 512x512)
|
126
|
+
get stored by convention in `blockydoge/token-i`.
|
127
|
+
Resulting in a file tree like:
|
128
|
+
|
129
|
+
```
|
130
|
+
blockydoge/token-i/
|
131
|
+
0.png
|
132
|
+
1.png
|
133
|
+
2.png
|
134
|
+
3.png
|
135
|
+
4.png
|
136
|
+
5.png
|
137
|
+
6.png
|
138
|
+
7.png
|
139
|
+
8.png
|
140
|
+
9.png
|
141
|
+
10.png
|
142
|
+
11.png
|
143
|
+
12.png
|
144
|
+
...
|
145
|
+
```
|
146
|
+
|
147
|
+
Example - `blockydoge/token-i/0.png` (512x512):
|
148
|
+
|
149
|
+
![](i/blockydoge0-512x512.png)
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
### Pixelate all downloaded images from the source format (e.g. 512x512) to the original format (e.g. 60x60)
|
156
|
+
|
157
|
+
Let's try:
|
158
|
+
|
159
|
+
```
|
160
|
+
$ artbase blockydoge px
|
161
|
+
```
|
162
|
+
|
163
|
+
Note: All referenced images pixelated down to the orginal format (e.g. 60x60)
|
164
|
+
get stored by convention in `blockydoge/60x60`.
|
165
|
+
Resulting in a tree like:
|
166
|
+
|
167
|
+
```
|
168
|
+
blockydoge/60x60/
|
169
|
+
1.png
|
170
|
+
2.png
|
171
|
+
3.png
|
172
|
+
4.png
|
173
|
+
5.png
|
174
|
+
6.png
|
175
|
+
7.png
|
176
|
+
8.png
|
177
|
+
9.png
|
178
|
+
10.png
|
179
|
+
11.png
|
180
|
+
12.png
|
181
|
+
13.png
|
182
|
+
...
|
183
|
+
```
|
184
|
+
|
185
|
+
|
186
|
+
Example - `blockydoge/60x60/1.png` to `13.png`:
|
187
|
+
|
188
|
+
![](i/blockydoge000001.png)
|
189
|
+
![](i/blockydoge000002.png)
|
190
|
+
![](i/blockydoge000003.png)
|
191
|
+
![](i/blockydoge000004.png)
|
192
|
+
![](i/blockydoge000005.png)
|
193
|
+
![](i/blockydoge000006.png)
|
194
|
+
![](i/blockydoge000007.png)
|
195
|
+
![](i/blockydoge000008.png)
|
196
|
+
![](i/blockydoge000009.png)
|
197
|
+
![](i/blockydoge000010.png)
|
198
|
+
![](i/blockydoge000011.png)
|
199
|
+
![](i/blockydoge000012.png)
|
200
|
+
![](i/blockydoge000013.png)
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
### Generate an all-in-one composite with the pixelated images
|
206
|
+
|
207
|
+
Let's try:
|
208
|
+
|
209
|
+
```
|
210
|
+
$ artbase blockydoge composite
|
211
|
+
```
|
212
|
+
|
213
|
+
Note: The all-in-one composite image gets saved by convention to `blockydoge/tmp/blockydoge-60x60.png`. Example:
|
214
|
+
|
215
|
+
![](i/blockydoge-60x60.png)
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
### Export all meta data attributes / traits to an all-in-one datafile in the comma-separated-values (.csv) format
|
220
|
+
|
221
|
+
|
222
|
+
Let's try:
|
223
|
+
|
224
|
+
```
|
225
|
+
$ artbase blockydoge export
|
226
|
+
```
|
227
|
+
|
228
|
+
Note: The all-in-one datafile gets saved by convention to `blockydoge/tmp/blockydoge.csv`.
|
229
|
+
Example:
|
230
|
+
|
231
|
+
|
232
|
+
```
|
233
|
+
ID, Name, Fur, Hat, Expression, Glasses, Accessories, Mask, Collar
|
234
|
+
0, Blocky Doge #1, Red Fur, Pink Party Hat, Smiley, , , ,
|
235
|
+
1, Blocky Doge #2, Black and Tan Fur, Orange Cap, Tongue Out, , , ,
|
236
|
+
2, Blocky Doge #3, , , Cream Fur, Teal Glasses, , ,
|
237
|
+
3, Blocky Doge #4, Meme Fur, , , Maroon Glasses, , ,
|
238
|
+
4, Blocky Doge #5, Black and Tan Fur, Blue Party Hat, , , , ,
|
239
|
+
5, Blocky Doge #6, Red Fur, Pink Cap, , , , ,
|
240
|
+
6, Blocky Doge #7, Red Fur, , , , None, ,
|
241
|
+
7, Blocky Doge #8, Meme Fur, White Cap, , , , ,
|
242
|
+
8, Blocky Doge #9, Cream Fur, , , Sunglasses, , ,
|
243
|
+
9, Blocky Doge #10, Meme Fur, , , , , Lavender Mask,
|
244
|
+
10, Blocky Doge #11, Black and Tan Fur, , , Black Glasses, , ,
|
245
|
+
11, Blocky Doge #12, Black and Tan Fur, , , , , Salmon Mask,
|
246
|
+
12, Blocky Doge #13, Cream Fur, Green Party Hat, , , , ,
|
247
|
+
...
|
248
|
+
```
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
That's it for now.
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
## Install
|
258
|
+
|
259
|
+
Just install the gem:
|
260
|
+
|
261
|
+
$ gem install artbase
|
262
|
+
|
263
|
+
|
264
|
+
## License
|
265
|
+
|
266
|
+
The `artbase` scripts are dedicated to the public domain.
|
267
|
+
Use it as you please with no restrictions whatsoever.
|
268
|
+
|
269
|
+
|
270
|
+
## Questions? Comments?
|
271
|
+
|
272
|
+
Post them on the [D.I.Y. Punk (Pixel) Art reddit](https://old.reddit.com/r/DIYPunkArt). Thanks.
|
data/Rakefile
CHANGED
@@ -1,29 +1,40 @@
|
|
1
|
-
require 'hoe'
|
2
|
-
require './lib/artbase/version.rb'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
self.
|
15
|
-
|
16
|
-
|
17
|
-
self.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
self.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/artbase/version.rb'
|
3
|
+
|
4
|
+
|
5
|
+
###
|
6
|
+
# hack/ quick fix for broken intuit_values - overwrite with dummy
|
7
|
+
class Hoe
|
8
|
+
def intuit_values( input ); end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
Hoe.spec 'artbase' do
|
13
|
+
|
14
|
+
self.version = Artbase::VERSION
|
15
|
+
|
16
|
+
self.summary = "artbase"
|
17
|
+
self.description = summary
|
18
|
+
|
19
|
+
self.urls = { home: 'https://github.com/pixelartexchange/artbase'}
|
20
|
+
|
21
|
+
self.author = 'Gerald Bauer'
|
22
|
+
self.email = 'wwwmake@googlegroups.com'
|
23
|
+
|
24
|
+
# switch extension to .markdown for gihub formatting
|
25
|
+
self.readme_file = 'README.md'
|
26
|
+
self.history_file = 'CHANGELOG.md'
|
27
|
+
|
28
|
+
self.extra_deps = [
|
29
|
+
['cocos', '>= 0.1.2'],
|
30
|
+
['webclient', '>= 0.2.2'],
|
31
|
+
['pixelart', '>= 1.3.6'],
|
32
|
+
]
|
33
|
+
|
34
|
+
self.licenses = ['Public Domain']
|
35
|
+
|
36
|
+
self.spec_extras = {
|
37
|
+
required_ruby_version: '>= 2.2.2'
|
38
|
+
}
|
39
|
+
|
40
|
+
end
|
data/bin/artbase
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
###################
|
4
|
+
# == DEV TIPS:
|
5
|
+
#
|
6
|
+
# For local testing run like:
|
7
|
+
#
|
8
|
+
# ruby -Ilib bin/artbase
|
9
|
+
#
|
10
|
+
# Set the executable bit in Linux. Example:
|
11
|
+
#
|
12
|
+
# % chmod a+x bin/artbase
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'artbase'
|
16
|
+
|
17
|
+
Artbase::Tool.main
|
@@ -0,0 +1,83 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
def counter_to_text( counter )
|
4
|
+
|
5
|
+
counter = counter.to_a
|
6
|
+
|
7
|
+
attribute_counter = counter[0]
|
8
|
+
more_counter = counter[1..-1]
|
9
|
+
|
10
|
+
|
11
|
+
puts "Attribute Counts\n"
|
12
|
+
trait_type, h = attribute_counter
|
13
|
+
|
14
|
+
total = h[:by_type].values.reduce(0) { |sum,count| sum+count }
|
15
|
+
|
16
|
+
|
17
|
+
types = h[:by_type]
|
18
|
+
types = types.sort { |l,r| l[0]<=>r[0] } ## sort by name
|
19
|
+
|
20
|
+
puts "\n"
|
21
|
+
puts "|Name|Total (%)|"
|
22
|
+
puts "|--------|----------:|"
|
23
|
+
|
24
|
+
types.each do |rec|
|
25
|
+
name = rec[0]
|
26
|
+
count = rec[1]
|
27
|
+
percent = Float(count*100)/Float(total)
|
28
|
+
|
29
|
+
puts "| **#{name} Attributes** | #{count} (#{'%.2f' % percent}) |"
|
30
|
+
end
|
31
|
+
puts "\n"
|
32
|
+
|
33
|
+
more_counter.each_with_index do |(trait_type, h),i|
|
34
|
+
print " · " if i > 0 ## add separator
|
35
|
+
print "#{trait_type } (#{h[:by_type].size})"
|
36
|
+
end
|
37
|
+
puts "\n\n"
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
more_counter.each do |trait_type, h|
|
42
|
+
print "### #{trait_type } (#{h[:by_type].size}) - "
|
43
|
+
print "∑Total #{h[:count]}/#{total}\n"
|
44
|
+
|
45
|
+
puts "\n"
|
46
|
+
puts "|Name|Total (%)|"
|
47
|
+
puts "|--------|----------:|"
|
48
|
+
|
49
|
+
types = h[:by_type]
|
50
|
+
types = types.sort do |l,r|
|
51
|
+
# sort by 1) by count
|
52
|
+
# 2) by name a-z
|
53
|
+
res = r[1] <=> l[1]
|
54
|
+
res = l[0] <=> r[0] if res == 0
|
55
|
+
res
|
56
|
+
end ## sort by count
|
57
|
+
types.each do |rec|
|
58
|
+
name = rec[0]
|
59
|
+
count = rec[1]
|
60
|
+
percent = Float(count*100)/Float(total)
|
61
|
+
|
62
|
+
puts "| **#{name}** | #{count} (#{'%.2f' % percent}) |"
|
63
|
+
end
|
64
|
+
puts "\n\n"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
def counter_to_csv( counter )
|
72
|
+
|
73
|
+
puts "type, name, count"
|
74
|
+
counter.each do |trait_type, h|
|
75
|
+
puts "#{trait_type}, ∑ Total, #{h[:count]}"
|
76
|
+
h[:by_type].each do |trait_value, count|
|
77
|
+
puts "#{trait_type}, #{trait_value}, #{count}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
|