animoto 1.5.4 → 1.5.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.
- data/lib/animoto/postrolls/custom_footage.rb +2 -2
- data/lib/animoto.rb +1 -1
- data/lib/example.rb +69 -0
- data/spec/animoto/postrolls/custom_footage_spec.rb +52 -0
- metadata +6 -4
@@ -6,7 +6,7 @@ module Animoto
|
|
6
6
|
|
7
7
|
# The URL to a video to insert into this custom footage postroll.
|
8
8
|
# @return [String]
|
9
|
-
attr_accessor :source_url
|
9
|
+
attr_accessor :source_url, :start_time, :duration
|
10
10
|
|
11
11
|
# Creates a new postroll with custom footage at the supplied
|
12
12
|
# URL.
|
@@ -23,7 +23,7 @@ module Animoto
|
|
23
23
|
#
|
24
24
|
# @return [Hash{String=>Object}]
|
25
25
|
def to_hash
|
26
|
-
super.merge({'source_url' => source_url})
|
26
|
+
super.merge({'source_url' => source_url, 'start_time' => start_time, 'duration' => duration})
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/animoto.rb
CHANGED
data/lib/example.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'animoto/client'
|
3
|
+
include Animoto
|
4
|
+
|
5
|
+
# Create a new client using our application key and secret
|
6
|
+
client = Client.new("bb0d0e005ac4012dc17712313b013462", "c0fe4cfca8bf544b8d0e687247a600ef55ff82e3")
|
7
|
+
client.endpoint = "https://platform-staging.animoto.com"
|
8
|
+
|
9
|
+
custom_footage = Postroll::CustomFootage.new("http://s3-s.animoto.com/Footage/wInVzO78f0SjP1GTFtfPrA/t.mp4") #("http://api.client.java.animoto.s3.amazonaws.com/test_assets/footage.mp4")
|
10
|
+
#custom_footage.start_time = 2.0
|
11
|
+
#custom_footage.duration = 5.0
|
12
|
+
|
13
|
+
# create a directing and rendering manifest with the video title and
|
14
|
+
# producer. Also include rendering parameters like resolution, framerate,
|
15
|
+
# and format.
|
16
|
+
manifest = Manifests::DirectingAndRendering.new(
|
17
|
+
:title => "Amazing Venus3!",
|
18
|
+
:resolution => "360p",
|
19
|
+
:style => "original",
|
20
|
+
:pacing => "fast",
|
21
|
+
:framerate => 24,
|
22
|
+
:format => 'h264',
|
23
|
+
:postroll => custom_footage
|
24
|
+
)
|
25
|
+
|
26
|
+
# Add some images, text, and footage to our manifest.
|
27
|
+
|
28
|
+
img1 = Assets::Image.new("http://cdn.toucharcade.com/wp-content/uploads/2012/12/hac1.jpg")
|
29
|
+
#img1.cover = "Doctorine of pace"
|
30
|
+
#img1.rotation = 2
|
31
|
+
#img1.spotlit = true
|
32
|
+
#img1.caption = "Birds can't walk"
|
33
|
+
|
34
|
+
img2 = Assets::Image.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/image.jpg")
|
35
|
+
img3 = Assets::Image.new("http://blogs.independent.co.uk/wp-content/uploads/2012/12/some-girls-300x225.jpg")
|
36
|
+
|
37
|
+
card1 = Assets::TitleCard.new("f1", "01234567890123456789")
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
manifest << img1
|
42
|
+
manifest << card1
|
43
|
+
#manifest << img2
|
44
|
+
#manifest << img3
|
45
|
+
#manifest << card2
|
46
|
+
#manifest << card3
|
47
|
+
|
48
|
+
# Setup the soundtrack.
|
49
|
+
manifest << Assets::Song.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/song.mp3", :artist => "Fishy Joe")
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
dr_job = client.direct_and_render!(manifest)
|
55
|
+
|
56
|
+
while dr_job.pending?
|
57
|
+
sleep(1)
|
58
|
+
puts "making it ready..."
|
59
|
+
client.reload!(dr_job)
|
60
|
+
end
|
61
|
+
# Setup to get http callbacks for status notification (see below for
|
62
|
+
# polling example).
|
63
|
+
#manifest.http_callback_url = "http://mysite.com/animoto_callback"
|
64
|
+
#manifest.http_callback_format = "json"
|
65
|
+
|
66
|
+
# Send the manifest to the API. Your app will be notified of
|
67
|
+
# completion/failure via an HTTP POST to
|
68
|
+
# "http://mysite.com/animoto_callback"
|
69
|
+
# client.direct_and_render!(manifest)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Animoto::Postroll::CustomFootage do
|
4
|
+
|
5
|
+
describe "initialization" do
|
6
|
+
before do
|
7
|
+
@custom_footage = Animoto::Postroll::CustomFootage.new 'http://website.com/movie.mp4'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should set the source to the given url" do
|
11
|
+
@custom_footage.source_url.should == 'http://website.com/movie.mp4'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should set the start time to the given time" do
|
15
|
+
@custom_footage.start_time = 1.0
|
16
|
+
@custom_footage.start_time.should == 1.0
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should set the duration to the given length" do
|
20
|
+
@custom_footage.duration = 5.0
|
21
|
+
@custom_footage.duration.should == 5.0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#to_hash" do
|
26
|
+
before do
|
27
|
+
@custom_footage = Animoto::Postroll::CustomFootage.new 'http://website.com/movie.mp4'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a 'source_url' key with the url" do
|
31
|
+
@custom_footage.to_hash.should have_key('source_url')
|
32
|
+
@custom_footage.to_hash['source_url'].should == @custom_footage.source_url
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "if start_time or/and duration is given" do
|
36
|
+
before do
|
37
|
+
@custom_footage.start_time = 2.0
|
38
|
+
@custom_footage.duration = 7.0
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have a 'start_time' key with the given start_time" do
|
42
|
+
@custom_footage.to_hash.should have_key('start_time')
|
43
|
+
@custom_footage.to_hash['start_time'].should == @custom_footage.start_time
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have a 'duration' key with the given duraiton" do
|
47
|
+
@custom_footage.to_hash.should have_key('duration')
|
48
|
+
@custom_footage.to_hash['duration'].should == @custom_footage.duration
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: animoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 5
|
10
|
+
version: 1.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Animoto
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-02-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- ./lib/animoto/support/standard_envelope.rb
|
84
84
|
- ./lib/animoto/support/string.rb
|
85
85
|
- ./lib/animoto.rb
|
86
|
+
- ./lib/example.rb
|
86
87
|
- ./spec/animoto/assets/base_spec.rb
|
87
88
|
- ./spec/animoto/assets/footage_spec.rb
|
88
89
|
- ./spec/animoto/assets/image_spec.rb
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- ./spec/animoto/manifests/rendering_spec.rb
|
96
97
|
- ./spec/animoto/manifests/storyboard_bundling_spec.rb
|
97
98
|
- ./spec/animoto/manifests/storyboard_unbundling_spec.rb
|
99
|
+
- ./spec/animoto/postrolls/custom_footage_spec.rb
|
98
100
|
- ./spec/animoto/resources/base_spec.rb
|
99
101
|
- ./spec/animoto/resources/jobs/base_spec.rb
|
100
102
|
- ./spec/animoto/resources/jobs/directing_and_rendering_spec.rb
|