rapinoe 0.0.3 → 0.0.4
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/Gemfile.lock +27 -2
- data/README.md +14 -0
- data/lib/rapinoe.rb +2 -1
- data/lib/rapinoe/keynote.rb +27 -0
- data/rapinoe.gemspec +5 -3
- data/test/test_keynote.rb +6 -0
- metadata +30 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 550991e7473762f0670891e9f0503b8b2a16f11b
|
4
|
+
data.tar.gz: 30cb491adade1c831e6cf798a73b6bd0cd45c198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ec4c8ed3d1bae0d96e8aa180e771ee3bbb3d71e533403124d001e9566b8d5cab130995441ae5ea91d43f5efcf2fe5183516a0ca47f67df220d6bb21e805c19
|
7
|
+
data.tar.gz: b84692450611c52a74a7b38e8276fc5e4dd4778b6a21105c931e71df6c31f9d4815d820f761fa9683fda8f77d1294deaa063cc90749aaf449a49541112294295
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rapinoe (0.0.
|
5
|
-
fastimage (~> 1.8.1)
|
4
|
+
rapinoe (0.0.3)
|
5
|
+
fastimage (~> 1.8, >= 1.8.1)
|
6
|
+
miro (~> 0.3, >= 0.3.0)
|
6
7
|
rubyzip (~> 1.1, >= 1.1.7)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: http://rubygems.org/
|
10
11
|
specs:
|
12
|
+
activesupport (4.2.5)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
json (~> 1.7, >= 1.7.7)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
17
|
+
tzinfo (~> 1.1)
|
11
18
|
addressable (2.4.0)
|
19
|
+
chunky_png (1.3.5)
|
20
|
+
climate_control (0.0.3)
|
21
|
+
activesupport (>= 3.0)
|
22
|
+
cocaine (0.5.8)
|
23
|
+
climate_control (>= 0.0.3, < 1.0)
|
24
|
+
color (1.8)
|
12
25
|
fastimage (1.8.1)
|
13
26
|
addressable (~> 2.3, >= 2.3.5)
|
27
|
+
i18n (0.7.0)
|
28
|
+
json (1.8.3)
|
29
|
+
minitest (5.8.3)
|
30
|
+
miro (0.3.0)
|
31
|
+
cocaine
|
32
|
+
color
|
33
|
+
oily_png
|
34
|
+
oily_png (1.2.0)
|
35
|
+
chunky_png (~> 1.3.1)
|
14
36
|
rubyzip (1.1.7)
|
37
|
+
thread_safe (0.3.5)
|
38
|
+
tzinfo (1.2.2)
|
39
|
+
thread_safe (~> 0.1)
|
15
40
|
|
16
41
|
PLATFORMS
|
17
42
|
ruby
|
data/README.md
CHANGED
@@ -8,6 +8,14 @@ Primarily it's designed to help you access the simple metadata of a Keynote file
|
|
8
8
|
|
9
9
|
## Install
|
10
10
|
|
11
|
+
First you'll need ImageMagick. If you use Homebrew, you'll be fine with a quick:
|
12
|
+
|
13
|
+
```sh
|
14
|
+
brew install imagemagick
|
15
|
+
```
|
16
|
+
|
17
|
+
Then install the gem:
|
18
|
+
|
11
19
|
```sh
|
12
20
|
gem install rapinoe
|
13
21
|
```
|
@@ -29,4 +37,10 @@ rapinoe.slides.first.write_preview_to_file("/tmp/slide-preview.jpg")
|
|
29
37
|
|
30
38
|
rapinoe.widescreen?
|
31
39
|
# => true
|
40
|
+
|
41
|
+
rapinoe.colors
|
42
|
+
# Returns the dominant colors in the first title slide by percentage order. Keys
|
43
|
+
# are in RGB format.
|
44
|
+
#
|
45
|
+
# => {[108, 190, 212]=>0.9550793650793651, [117, 124, 143]=>0.012619047619047618, [125, 83, 100]=>0.010158730158730159, [143, 23, 33]=>0.009603174603174603, [151, 10, 16]=>0.007301587301587302, [133, 49, 62]=>0.005238095238095238}
|
32
46
|
```
|
data/lib/rapinoe.rb
CHANGED
data/lib/rapinoe/keynote.rb
CHANGED
@@ -47,6 +47,33 @@ module Rapinoe
|
|
47
47
|
aspect_ratio == :widescreen
|
48
48
|
end
|
49
49
|
|
50
|
+
# The top colors present in the title slide.
|
51
|
+
#
|
52
|
+
# This returns a Hash of the color (in RGB) and its percentage in the frame.
|
53
|
+
# For example:
|
54
|
+
#
|
55
|
+
# {
|
56
|
+
# [1, 1, 1] => 0.7296031746031746,
|
57
|
+
# [8, 12, 15] => 0.13706349206349205,
|
58
|
+
# [ … ]
|
59
|
+
# }
|
60
|
+
def colors
|
61
|
+
return @colors if @colors
|
62
|
+
|
63
|
+
path = "/tmp/rapinoe-aspect"
|
64
|
+
write_preview_to_file(path)
|
65
|
+
|
66
|
+
colors = Miro::DominantColors.new(path)
|
67
|
+
by_percentage = colors.by_percentage
|
68
|
+
hash = {}
|
69
|
+
|
70
|
+
colors.to_rgb.each_with_index do |hex, i|
|
71
|
+
hash[hex] = by_percentage[i]
|
72
|
+
end
|
73
|
+
|
74
|
+
@colors = hash
|
75
|
+
end
|
76
|
+
|
50
77
|
def slides
|
51
78
|
@data.glob("Data/st*").map do |preview_jpg_data|
|
52
79
|
Slide.new(preview_jpg_data.get_input_stream.read)
|
data/rapinoe.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rapinoe'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.4'
|
4
4
|
s.licenses = ['MIT']
|
5
5
|
s.summary = "Parse Keynote files in Ruby."
|
6
6
|
s.description = "Rapinoe is designed to parse the native files for Apple's Keynote presentation software. Its main focus is to help extract previews and general metadata about the presentation."
|
@@ -9,8 +9,10 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.files = ["lib/rapinoe.rb"]
|
10
10
|
s.homepage = 'https://github.com/holman/rapinoe'
|
11
11
|
s.require_paths = %w[lib]
|
12
|
-
s.
|
13
|
-
s.add_runtime_dependency '
|
12
|
+
s.requirements = 'ImageMagick'
|
13
|
+
s.add_runtime_dependency 'miro', '~> 0.3', '>= 0.3.0'
|
14
|
+
s.add_runtime_dependency 'fastimage', '~> 1.8', '>= 1.8.1'
|
15
|
+
s.add_runtime_dependency 'rubyzip', '~> 1.1', '>= 1.1.7'
|
14
16
|
|
15
17
|
# = MANIFEST =
|
16
18
|
s.files = %w[
|
data/test/test_keynote.rb
CHANGED
@@ -35,6 +35,12 @@ class TestKeynote < Test::Unit::TestCase
|
|
35
35
|
assert @keynote.widescreen?
|
36
36
|
end
|
37
37
|
|
38
|
+
def test_colors
|
39
|
+
assert_kind_of Hash, @keynote.colors
|
40
|
+
assert_equal [108, 190, 212], @keynote.colors.first[0]
|
41
|
+
assert_equal 0.9550793650793651, @keynote.colors.first[1]
|
42
|
+
end
|
43
|
+
|
38
44
|
def test_preview_data
|
39
45
|
assert_equal 32858, @keynote.preview_data.size
|
40
46
|
end
|
metadata
CHANGED
@@ -1,20 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapinoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Holman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: miro
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.3.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.3.0
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: fastimage
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
16
36
|
requirements:
|
17
37
|
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.8'
|
40
|
+
- - ">="
|
18
41
|
- !ruby/object:Gem::Version
|
19
42
|
version: 1.8.1
|
20
43
|
type: :runtime
|
@@ -22,6 +45,9 @@ dependencies:
|
|
22
45
|
version_requirements: !ruby/object:Gem::Requirement
|
23
46
|
requirements:
|
24
47
|
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.8'
|
50
|
+
- - ">="
|
25
51
|
- !ruby/object:Gem::Version
|
26
52
|
version: 1.8.1
|
27
53
|
- !ruby/object:Gem::Dependency
|
@@ -83,7 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
109
|
- - ">="
|
84
110
|
- !ruby/object:Gem::Version
|
85
111
|
version: '0'
|
86
|
-
requirements:
|
112
|
+
requirements:
|
113
|
+
- ImageMagick
|
87
114
|
rubyforge_project:
|
88
115
|
rubygems_version: 2.5.1
|
89
116
|
signing_key:
|