artbase 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87bc502d50a03cc25b694c89244023a1941c037f7940a942a092faa69c73b43d
4
- data.tar.gz: 5746f5444e7baf0d61399c3f294a5a34222077832100eccac96cad1df4f6683a
3
+ metadata.gz: fa2c17e20eba3ef7a381f5643f4f2fde0d7bed07bf1ea613fe4da8a324f5c500
4
+ data.tar.gz: 7f124deeb894095131e7e472286deebc0703fd2ffbfa9bb1167e58a59745c4c5
5
5
  SHA512:
6
- metadata.gz: b38b6d8785e9302125fc447ff2eee16d4293cdc4960448b7579f56702f7ab8bda347a90fe13c1b70e0fbcc3b6bc3ccd89295f32758144a3fda361248578e8eee
7
- data.tar.gz: dc14177cc1236ecadafc3d3330de68367b17f272aa77c50f045fd1eb1906367d1b920ae5948c276199a4df0c4a49688b2f34ea9f09f83cac1b04e5629790c960
6
+ metadata.gz: 74533360be3826d67c3b3b286fdeaabbe5623df8efa4dba377a3b2d6cadf8299c858202274ac4be69be581b722ee2c81e6edd5d3193b1dd80dbe5d98264e01f1
7
+ data.tar.gz: b80f2676cf847d875ac321a9ee6ffb30357fe306c88173d08bc9cddbe0928e2c722a66fe5b8b9786dede41f3b12647ff99db5b4da2138ac937d7f332f6ebe53c
data/LICENSE.md ADDED
@@ -0,0 +1,116 @@
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/>
data/Manifest.txt CHANGED
@@ -1,6 +1,21 @@
1
1
  CHANGELOG.md
2
+ LICENSE.md
2
3
  Manifest.txt
3
4
  README.md
4
5
  Rakefile
6
+ bin/artbase
5
7
  lib/artbase.rb
8
+ lib/artbase/attributes.rb
9
+ lib/artbase/collection.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/24x24.rb
16
+ lib/artbase/image/32x32.rb
17
+ lib/artbase/image/60x60.rb
18
+ lib/artbase/image/80x80.rb
19
+ lib/artbase/opensea.rb
20
+ lib/artbase/tool.rb
6
21
  lib/artbase/version.rb
data/README.md CHANGED
@@ -1,17 +1,31 @@
1
- # Art Base
1
+ # artbase ("right-clicker") command line tool & scripts - download complete pixel art collections - yes, you can! - automate "right-click 'n' download" and much more
2
2
 
3
- artbase gem
4
-
5
- * home :: [github.com/pixelartexchange/opensea.sandbox](https://github.com/pixelartexchange/opensea.sandbox)
6
- * bugs :: [github.com/pixelartexchange/opensea.sandbox/issues](https://github.com/pixelartexchange/opensea.sandbox/issues)
3
+ * home :: [github.com/pixelartexchange/artbase](https://github.com/pixelartexchange/artbase)
4
+ * bugs :: [github.com/pixelartexchange/artbase/issues](https://github.com/pixelartexchange/artbase/issues)
7
5
  * gem :: [rubygems.org/gems/artbase](https://rubygems.org/gems/artbase)
8
6
  * rdoc :: [rubydoc.info/gems/artbase](http://rubydoc.info/gems/artbase)
9
- * forum :: [wwwmake](http://groups.google.com/group/wwwmake)
7
+
10
8
 
11
9
 
12
10
  ## Usage
13
11
 
14
- to be done
12
+
13
+ Note: The artbase is alpha - it's still the early days - it's a work-in-progress.
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ ## Install
25
+
26
+ Just install the gem:
27
+
28
+ $ gem install artbase
15
29
 
16
30
 
17
31
  ## License
@@ -22,5 +36,4 @@ Use it as you please with no restrictions whatsoever.
22
36
 
23
37
  ## Questions? Comments?
24
38
 
25
- Send them along to the [wwwmake forum](http://groups.google.com/group/wwwmake).
26
- Thanks!
39
+ Post them on the [CryptoPunksDev reddit](https://old.reddit.com/r/CryptoPunksDev). Thanks.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'artbase' do
8
8
  self.summary = "artbase"
9
9
  self.description = summary
10
10
 
11
- self.urls = { home: 'https://github.com/pixelartexchange/opensea.sandbox'}
11
+ self.urls = { home: 'https://github.com/pixelartexchange/artbase'}
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'wwwmake@googlegroups.com'
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
+
@@ -0,0 +1,39 @@
1
+
2
+
3
+ class ImageCollection
4
+
5
+ attr_reader :slug, :count
6
+
7
+ def initialize( slug, count,
8
+ image_base: ) # check: rename count to items or such - why? why not?
9
+ @slug = slug
10
+ @count = count
11
+ @image_base = image_base
12
+ end
13
+
14
+ def download_images( range=(0...@count) )
15
+ start = Time.now
16
+ delay_in_s = 0.3
17
+
18
+ range.each do |offset|
19
+ image_src = @image_base.sub( '{id}', offset.to_s )
20
+
21
+ puts "==> #{offset} - #{@slug}..."
22
+
23
+ ## note: will auto-add format file extension (e.g. .png, .jpg)
24
+ ## depending on http content type!!!!!
25
+ copy_image( image_src, "./#{@slug}/image-i/#{offset}" )
26
+
27
+ stop = Time.now
28
+ diff = stop - start
29
+
30
+ mins = diff / 60 ## todo - use floor or such?
31
+ secs = diff % 60
32
+ puts "up #{mins} mins #{secs} secs (total #{diff} secs)"
33
+
34
+ puts "sleeping #{delay_in_s}s..."
35
+ sleep( delay_in_s )
36
+ end
37
+ end
38
+ end # class ImageCollection
39
+