animoto 0.0.0.alpha7 → 0.0.0.alpha8
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -114,7 +114,6 @@ client and using HTTP callbacks for status updates.
|
|
114
114
|
# "http://mysite.com/animoto_callback"
|
115
115
|
client.direct_and_render!(manifest)
|
116
116
|
|
117
|
-
|
118
117
|
### A basic example using the Ruby client
|
119
118
|
|
120
119
|
This example shows how to separately direct a storyboard and render a video
|
@@ -129,7 +128,7 @@ status.
|
|
129
128
|
|
130
129
|
# Create a directing manifest. The directing manifest controls the images
|
131
130
|
# and other visual elements that will be in our final video.
|
132
|
-
manifest = DirectingManifest.new(:title => "Amazing Title!"
|
131
|
+
manifest = DirectingManifest.new(:title => "Amazing Title!")
|
133
132
|
|
134
133
|
# Add some images, text, and footage to our manifest.
|
135
134
|
manifest << Image.new("http://website.com/picture.png")
|
@@ -138,7 +137,7 @@ status.
|
|
138
137
|
manifest << Footage.new("http://website.com/movie.mp4", :duration => 3.5)
|
139
138
|
|
140
139
|
# Setup the soundtrack.
|
141
|
-
manifest << Song.new("http://website.com/song.mp3"
|
140
|
+
manifest << Song.new("http://website.com/song.mp3")
|
142
141
|
|
143
142
|
# Request a new directing job by sending the API our directing manifest.
|
144
143
|
directing_job = client.direct!(manifest)
|
@@ -169,7 +168,8 @@ status.
|
|
169
168
|
# If the job has a video associated with it, everything worked out ok.
|
170
169
|
if video = rendering_job.video
|
171
170
|
# Print a link to download the video file.
|
172
|
-
|
171
|
+
client.reload!(video)
|
172
|
+
puts video.download_url
|
173
173
|
else
|
174
174
|
# Something happened during rendering...
|
175
175
|
raise rendering_job.errors.first
|
data/integration/test.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rdiscount'
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
puts "Reading in code from README.md"
|
7
|
+
|
8
|
+
readme_path = File.dirname(__FILE__) + '/../README.md'
|
9
|
+
begin
|
10
|
+
readme = RDiscount.new(File.read(readme_path))
|
11
|
+
rescue Errno::ENOENT
|
12
|
+
raise "README.md not found in #{File.expand_path(readme_path)}!"
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
credentials = YAML.load(File.read(File.dirname(__FILE__) + '/credentials.yml'))
|
17
|
+
rescue Errno::ENOENT
|
18
|
+
raise "Credentials file not found at #{File.expand_path(File.dirname(__FILE__) + '/credentials.yml')}!"
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
assets = YAML.load(File.read(File.dirname(__FILE__) + '/assets.yml'))
|
23
|
+
rescue Errno::ENOENT
|
24
|
+
raise "Assets file not found in at #{File.dirname(__FILE__) + '/assets.yml'}!" unless assets
|
25
|
+
end
|
26
|
+
|
27
|
+
doc = Nokogiri::HTML(readme.to_html)
|
28
|
+
example_code_path = '//h3[contains(text(),"basic example")]/following-sibling::pre/code/text()'
|
29
|
+
code_node = doc.at(example_code_path)
|
30
|
+
|
31
|
+
raise "Example code not found in README (expected at xpath '#{example_code_path}')" unless code_node
|
32
|
+
|
33
|
+
code = code_node.text
|
34
|
+
|
35
|
+
puts "Replacing example credentials with valid ones"
|
36
|
+
code.sub!(/Client\.new\(.+\)/, %Q{Client.new("#{credentials[:key]}","#{credentials[:secret]}")})
|
37
|
+
|
38
|
+
puts "Replacing example assets with valid ones"
|
39
|
+
code.gsub!(/Image\.new\(.+\)/) { %Q{Image.new("#{assets[:images].shift}")} }
|
40
|
+
# Replace the song with a real one
|
41
|
+
code.sub!(/Song\.new\(.+\)/, %Q{Song.new("#{assets[:song]}")})
|
42
|
+
# Get rid of the footage (since it won't render right now anyway)
|
43
|
+
code = code.lines.reject { |l| /Footage\.new/ === l }.join
|
44
|
+
|
45
|
+
puts "Executing example"
|
46
|
+
eval code
|
47
|
+
|
48
|
+
puts
|
49
|
+
puts "If you're seeing this, things should have worked fine!"
|
50
|
+
puts "Enjoy your video at #{video.download_url}"
|
data/lib/animoto/client.rb
CHANGED
@@ -220,9 +220,9 @@ module Animoto
|
|
220
220
|
def request method, url, body, headers = {}, options = {}
|
221
221
|
error = catch(:fail) do
|
222
222
|
options = { :username => @key, :password => @secret }.merge(options)
|
223
|
-
@logger.info "Sending request to #{url.inspect} with body #{body
|
223
|
+
@logger.info "Sending request to #{url.inspect} with body #{body}"
|
224
224
|
response = http_engine.request(method, url, body, headers, options)
|
225
|
-
@logger.info "Received response #{response
|
225
|
+
@logger.info "Received response #{response}"
|
226
226
|
return response_parser.parse(response)
|
227
227
|
end
|
228
228
|
if error
|
@@ -13,11 +13,11 @@ module Animoto
|
|
13
13
|
def to_hash options = {}
|
14
14
|
hash = super
|
15
15
|
directing_job = hash.delete('directing_job')
|
16
|
-
hash['directing_and_rendering_job'] = directing_job.merge('rendering_manifest' => { '
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
hash['directing_and_rendering_job'] = directing_job.merge('rendering_manifest' => { 'rendering_parameters' => {}})
|
17
|
+
params = hash['directing_and_rendering_job']['rendering_manifest']['rendering_parameters']
|
18
|
+
params['resolution'] = resolution
|
19
|
+
params['framerate'] = framerate
|
20
|
+
params['format'] = format
|
21
21
|
hash
|
22
22
|
end
|
23
23
|
|
data/lib/animoto.rb
CHANGED
@@ -111,18 +111,18 @@ describe Animoto::DirectingAndRenderingManifest do
|
|
111
111
|
@hash = manifest.to_hash['directing_and_rendering_job']['rendering_manifest']
|
112
112
|
end
|
113
113
|
|
114
|
-
it "should have a '
|
115
|
-
@hash.should have_key('
|
116
|
-
@hash['
|
114
|
+
it "should have a 'rendering_parameters' object in the manifest" do
|
115
|
+
@hash.should have_key('rendering_parameters')
|
116
|
+
@hash['rendering_parameters'].should be_a(Hash)
|
117
117
|
end
|
118
118
|
|
119
|
-
describe "
|
119
|
+
describe "rendering_parameters" do
|
120
120
|
before do
|
121
|
-
@profile = @hash['
|
121
|
+
@profile = @hash['rendering_parameters']
|
122
122
|
end
|
123
123
|
|
124
|
-
it "should have a '
|
125
|
-
@profile['
|
124
|
+
it "should have a 'resolution' key" do
|
125
|
+
@profile['resolution'].should == manifest.resolution
|
126
126
|
end
|
127
127
|
|
128
128
|
it "should have a 'framerate' key" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: animoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1710980406
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.0.0.
|
10
|
+
- alpha8
|
11
|
+
version: 0.0.0.alpha8
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Animoto
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-16 00:00:00 -04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -45,6 +45,7 @@ extra_rdoc_files: []
|
|
45
45
|
|
46
46
|
files:
|
47
47
|
- README.md
|
48
|
+
- ./integration/test.rb
|
48
49
|
- ./lib/animoto/asset.rb
|
49
50
|
- ./lib/animoto/client.rb
|
50
51
|
- ./lib/animoto/content_type.rb
|