#!/usr/bin/env ruby require 'ruby-debug' require 'animoto/client' include Animoto # Create a new client using our application key and secret client = Client.new("bb0d0e005ac4012dc17712313b013462", "c0fe4cfca8bf544b8d0e687247a600ef55ff82e3") client.endpoint = "https://platform-staging.animoto.com" #client = Client.new("698dbba063bc012ea77d1231380e2ed9", "fd3dc39b57878951b480db818c2f3c15") #client.endpoint = "https://platform-sandbox.animoto.com" custom_footage = Postroll::CustomFootage.new("http://s3-s.animoto.com/Footage/wInVzO78f0SjP1GTFtfPrA/t.mp4?v=animotopro") #custom_footage = Postroll::CustomFootage.new("http://s3-s.animoto.com/Footage/wInVzO78f0SjP1GTFtfPrA/t.mp4") custom_footage = Postroll::CustomFootage.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/footage.mp4") custom_footage.start_time = 2.0 custom_footage.duration = 3.0 #application_data = {'application_data' => ['title', 'id', 'kind', 'type']} #{'partner_metadata' => ['partner_user_id', 'commercial_use', 'partner_intent', application_data]} app = {'title' => 'hello', 'id' => 'asdf', 'kind' => 'my', 'type' => 'video'} metadata = {'partner_user_id' => '234', 'commercial_use' => 'our wish', 'partner_intent' => 'business', 'application_data' => app} # create a directing and rendering manifest with the video title and # producer. Also include rendering parameters like resolution, framerate, # and format. manifest = Manifests::DirectingAndRendering.new( :title => "Amazing Venus3!", :resolution => "360p", :style => "original", :pacing => "fast", :framerate => 24, :format => 'h264', :partner_metadata => metadata, :postroll => custom_footage ) id = { "partner_user_id" => "42-24010"} # Add some images, text, and footage to our manifest. img1 = Assets::Image.new("http://cdn.toucharcade.com/wp-content/uploads/2012/12/hac1.jpg") #img1.cover = "Doctorine of pace" #img1.rotation = 2 #img1.spotlit = true img1.caption = "Birds can't walk" img2 = Assets::Image.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/image.jpg") img3 = Assets::Image.new("http://blogs.independent.co.uk/wp-content/uploads/2012/12/some-girls-300x225.jpg") card1 = Assets::TitleCard.new("f1", "01234567890123456789") card2 = Assets::TitleCard.new("f1", "012sssh 256789") card3 = Assets::TitleCard.new("f1", "01234333333") footage1 = Assets::Footage.new("http://s3-s.animoto.com/Footage/wInVzO78f0SjP1GTFtfPrA/t.mp4") manifest << img1 manifest << card1 manifest << img2 manifest << img3 manifest << card2 manifest << card3 manifest << footage1 # Setup the soundtrack. manifest << Assets::Song.new("http://api.client.java.animoto.s3.amazonaws.com/test_assets/song.mp3", :artist => "Fishy Joe") dr_job = client.direct_and_render!(manifest) while dr_job.pending? sleep(1) puts "making it ready..." client.reload!(dr_job) end # Setup to get http callbacks for status notification (see below for # polling example). #manifest.http_callback_url = "http://mysite.com/animoto_callback" #manifest.http_callback_format = "json" # Send the manifest to the API. Your app will be notified of # completion/failure via an HTTP POST to # "http://mysite.com/animoto_callback" # client.direct_and_render!(manifest)