zooniverse_data 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/zooniverse_data/helpers/images.rb +15 -4
- data/lib/zooniverse_data/projects.rb +5 -4
- data/lib/zooniverse_data/projects/serengeti.rb +41 -0
- data/lib/zooniverse_data/projects/sunspot.rb +6 -2
- data/lib/zooniverse_data/version.rb +1 -1
- data/zooniverse_data.gemspec +2 -0
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53cd2b2843d40809cdc0faee1debece7214d97cd
|
4
|
+
data.tar.gz: ecf9011a824ca59388c926625b1ac4a7e5e2ce77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab460f29dde5bddf4e08b525a70d99261e7fa49b8fb8f00279f0e0dae347330970373dab331c22700115821ae7e4a51ee0a32f332af673015d9fb6750b4425a
|
7
|
+
data.tar.gz: 467c59c6cc5bc518d683003738fe8a1df58f48c3e5beb03a85cae0086d4e4f47346a81a6940728e02b32291216ff7e3f7060f06cef27a4e484722d73d99f08b9
|
@@ -72,15 +72,26 @@ module ZooniverseData
|
|
72
72
|
self.flags = []
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def command(string)
|
76
|
+
tap do
|
77
|
+
self.flags << string
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def resize(width: nil, height: nil, force: true, type: nil)
|
76
82
|
tap do
|
77
83
|
resize_type = type ? "#{ type }-resize" : 'resize'
|
78
|
-
|
84
|
+
|
85
|
+
if width && height
|
86
|
+
self.flags << "-#{ resize_type } #{ width }x#{ height }#{ force ? '\!' : '' }"
|
87
|
+
elsif width || height
|
88
|
+
self.flags << "-#{ resize_type } #{ [width, height].join('x') }"
|
89
|
+
end
|
79
90
|
end
|
80
91
|
end
|
81
92
|
|
82
|
-
def adaptive_resize(width: width, height: height)
|
83
|
-
resize width: width, height: height, type: 'adaptive'
|
93
|
+
def adaptive_resize(width: width, height: height, force: true)
|
94
|
+
resize width: width, height: height, type: 'adaptive', force: force
|
84
95
|
end
|
85
96
|
|
86
97
|
def percentage_resize(percentage, type: nil)
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module ZooniverseData
|
2
2
|
module Projects
|
3
|
-
autoload :Default,
|
4
|
-
autoload :Asteroid,
|
5
|
-
autoload :MilkyWay,
|
6
|
-
autoload :
|
3
|
+
autoload :Default, 'zooniverse_data/projects/default'
|
4
|
+
autoload :Asteroid, 'zooniverse_data/projects/asteroid'
|
5
|
+
autoload :MilkyWay, 'zooniverse_data/projects/milky_way'
|
6
|
+
autoload :Serengeti, 'zooniverse_data/projects/serengeti'
|
7
|
+
autoload :Sunspot, 'zooniverse_data/projects/sunspot'
|
7
8
|
end
|
8
9
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ZooniverseData
|
2
|
+
module Projects
|
3
|
+
class Serengeti
|
4
|
+
include Helpers
|
5
|
+
|
6
|
+
def customize_subject
|
7
|
+
entry.update :$set => { 'metadata.capture_event_id' => entry.product_id.to_s }
|
8
|
+
new_locations = {
|
9
|
+
'standard' => [],
|
10
|
+
'thumbnail' => [],
|
11
|
+
'large' => []
|
12
|
+
}
|
13
|
+
|
14
|
+
entry.location['standard'].each do |path|
|
15
|
+
large_image = large_converter path
|
16
|
+
new_locations['large'] << large_image
|
17
|
+
new_locations['standard'] << converter_for(large_image, type: 'standard', max_size: 600)
|
18
|
+
new_locations['thumbnail'] << converter_for(large_image, type: 'thumbnail', max_size: 300)
|
19
|
+
end
|
20
|
+
|
21
|
+
set_location new_locations
|
22
|
+
end
|
23
|
+
|
24
|
+
def large_converter(path)
|
25
|
+
convert_image(path)
|
26
|
+
.command('-gravity South -chop 0x100')
|
27
|
+
.write_to(prefix: 'large')
|
28
|
+
.path
|
29
|
+
end
|
30
|
+
|
31
|
+
def converter_for(path, type: type, max_size: max_size)
|
32
|
+
convert_image(path, remove_original: false)
|
33
|
+
.command('-gravity South -chop 0x100')
|
34
|
+
.resize(width: max_size, height: max_size, force: false)
|
35
|
+
.quality(80)
|
36
|
+
.write_to(prefix: type)
|
37
|
+
.path
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -6,8 +6,12 @@ module ZooniverseData
|
|
6
6
|
def customize_subject
|
7
7
|
standard = convert_to_jpeg entry.location['standard']
|
8
8
|
inverted = convert_image(standard.path, remove_original: false).invert.write_to(prefix: 'inverted')
|
9
|
-
|
10
|
-
|
9
|
+
if entry.location['context']
|
10
|
+
context_image = convert_to_jpeg(entry.location['context'])
|
11
|
+
set_location standard: standard.path, inverted: inverted.path, context: context_image.try(:path)
|
12
|
+
else
|
13
|
+
set_location standard: standard.path, inverted: inverted.path
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
data/zooniverse_data.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
22
|
spec.add_development_dependency 'rake', '10.1.0'
|
23
|
+
spec.add_development_dependency 'bson', '1.9.2'
|
24
|
+
spec.add_development_dependency 'bson_ext', '1.9.2'
|
23
25
|
spec.add_runtime_dependency 'fastimage', '1.6.0'
|
24
26
|
spec.add_runtime_dependency 'aws-sdk', '1.30.0'
|
25
27
|
spec.required_ruby_version = '>= 2.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zooniverse_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Parrish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 10.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bson
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.9.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.9.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bson_ext
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.9.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.9.2
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: fastimage
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +115,7 @@ files:
|
|
87
115
|
- lib/zooniverse_data/projects/asteroid.rb
|
88
116
|
- lib/zooniverse_data/projects/default.rb
|
89
117
|
- lib/zooniverse_data/projects/milky_way.rb
|
118
|
+
- lib/zooniverse_data/projects/serengeti.rb
|
90
119
|
- lib/zooniverse_data/projects/sunspot.rb
|
91
120
|
- lib/zooniverse_data/version.rb
|
92
121
|
- zooniverse_data.gemspec
|