How to fetch ooyala image? - image

I've been looking around the web all day long but I'm not able to find a way to get the URL for a video image that's hosted on Ooyala. I read that the URL's vary from video to video, but I wonder if there isn't ANY way to get the image from the embed code.
In case you're wondering, I'm not uploading the vids to Ooyala myself, I'm simply running a site that embeds some Ooyala vids (as well as videos from other sites). Does anyone have a solution, or is there simply no way for me to get a preview image?
Thanks!

I don't know on which technology you are working upon. But i have used ruby on rails with ooyala V2. So Ooyala have a ruby on rails module. Which can be downloaded from their site.
Also, u need to have OOYALA_API_KEY,OOYALA_V2_SECRET_CODE. Which u can get by logging into ur ooyala account under developer section.
After getting the module of ruby on rails from ooyala.
The code is simple as follows:
ooyala_obj = Ooyala::API.new(OOYALA_API_KEY,OOYALA_V2_SECRET_CODE)
thumbnail = ''
response = ooyala_obj.get("/v2/assets/#{embed_code}/generated_preview_images")
response.each do |attribute|
if attribute["url"].present?
thumbnail = attribute["url"]
break
end
end
return thumbnail
As only embed code will not work, you need to have a verfied signature to get the generated preview image from ooyala which is only done by API KEY AND SECRET CODE.
I hope I helped you..

Related

Image hosting with Dropbox in Ruby

Hi I'm trying to use Dropbox as an imaging hosting server. The framework is currently Ruby.
I tried to use /media or /shares to get the data's url. When I use "/media" command, it seems the image can be hosted for a couple of hours but at the end it expires(4? hours roughly). If possible, I want to know how to set the expiration dates for this ( at something like 1 year? ), not manually, but in a programmable manner.
[How I extract "url" in Ruby]
image_1_link = Drop_client.media('path_name')["url"]
pdf_link = Drop_client.shares(''path_name'["url"]
The below is a sample link after using "/media".
"https://dl.dropboxusercontent.com/1/view/e9lr642qerdmgm9/Apps/ringle_records/images/Test_1image_1?dl=1"
When I use "/share", the generated link looks like "https://db.tt/Zs0v4yaffal?dl=1". But it can't host the image if I use it as . If I put this type of address, it leads to dropbox page and ask manual downloading.
I want to know how to generate link for imaging hosting so that can work for 1 year or at least for a couple of months!
Thanks for reading my question!
/media links expire after 4 hours, as documented.
/shares takes a parameter, short_url, that can be set to false to return an unshortened URL. Unfortunately, I believe the v1 Ruby SDK doesn't support this parameter. You can either modify the Ruby SDK yourself or get the shortened URL and unshorten it yourself. (Make an HTTP GET request to the short URL and grab the Location header of the redirect response.)
Once you have an unshortened URL, you can modify it per www.dropbox.com/help/201 to get a link directly to the content. Specifically, you should use the raw=1 query parameter.

Reading a Google Spreadsheet into Ruby Objects (or settle for a file download)

I think it's probably simplest to start with my use case:
I'm trying to read the contents of a Google Spreadsheet into ruby, and then use that data for other purposes. This needs to happen server-to-server.
Here's what I've tried:
First I tried to use this google drive gem. Since my interaction needs to be server to server (i.e. a service account), I couldn't get this to work (someone please let me know if they've managed this!)
Next, I tried using the latest google-api-ruby gem, and, following its documentation, was successfully able to authenticate my service account, and have been able to get lists of files, etc. So basically the API is authenticated and working.
The latest issue is that Google Spreadsheets can't be downloaded using the normal download_dest parameter on the get_file method (sorry - would post links to relevant documentation here, but don't have enough rep to do so). So I'm not really sure how to proceed with downloading the relevant file (I understand how to get an export_link), but have no clue how to then prepare the next request).
Any help would be greatly appreciated :)
Here's some basic code for reference -
require 'googleauth'
require 'google/apis/drive_v2'
scopes = ['https://www.googleapis.com/auth/drive']
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = 'path/to/my/creds.json'
auth = Google::Auth.get_application_default(scopes)
drive = Google::Apis::DriveV2::DriveService.new
drive.authorization = auth
ss = drive.get_file('my_spreadsheet_id')
export_url = ss.export_links
# what now?

wami-recorder and Sinatra

I need my users to record a voice clip. I'm using wami-recorder to take care of the voice recording on the client side. I am using the default javascript functions:
Wami.startRecording('/upload?name=mysound.wav');
Wami.stopRecording();
In the chrome console, I can see the post request being sent successfully because, when I use the wami-recorder default url "https://wami-recorder.appspot.com/audio", it works fine. But I can't seem to receive the file on the backend, Sinatra. How do I get the file and store it? Can someone point me in the right direction?
This is my controller:
post "/upload" do
p params
end
The output is just:
{"name"=>"file.wav"}
The audio is posted as part of the raw body. I was able to save the file in rails using
request.raw_post
on some brief googling it appears that you should be able to do the same in sinatra with
request.env["rack.input"].read
You can then save this directly to a file
file = File.new("audio.wav", "w+b")
file.write request.env["rack.input"].read
file.close
This should save out a wav file within the same directory

How do you open the native map app from the browser?

This is a simple task on iPhone as it hijacks google map urls automatically. Android you use the geo protocol, blackberry has a bit of JS. How can you do this on WP7? From what I can tell it is not possible but hopefully someone out there knows more than me! To be clear I am talking about opening the native map app from the browser, not another app.
I've gotten the maps app to open from within my app by opening up a WebBrowser, so I'm guessing this will work straight from the webbrowser. Obviously you'll need to modify it to use JS, but the code is simple and you'll be able to understand what's going on.
string location = "maps:" + SelectedLocation.Street + " " + SelectedLocation.PostalCode;
location = HttpUtility.UrlEncode(location);
TaskHelper.WebPage(location);
Additionally, the bing maps probably supports routes in the same way it does via a normal URL:
from Build your own URL :
The following example shows a route on the map from a specific address to a specific point:
http://bing.com/maps/default.aspx?v=2&rtp=adr.One%20Microsoft Way,%20Redmond,%20WA%2098052~pos.45.23423_-122.1232_MyPlace
I've documented my findings here:
http://www.habaneros.com/blog/posts/Opening_native_map_apps_from_the_mobile_browser.aspx

Is it possible to get the picture token from Picture Class?

to receive a Picture over Picture Hub this code works fine:
MediaLibrary library = new MediaLibrary();
Picture picture = library.GetPictureFromToken(NavigationContext.QueryString["token"]);
Is it possible, to get the token string from the Picture instance?
Any casts your tricks?
To uniquely identify a Picture in the MediaLibrary you'l need to use a combination of Name and Date.
You coudl also try using HashCode but when you have a large number of images it can be easier to find an image by name than checking the HashCode of all images.
From what I can gather, the token is provided to your application (intended as an "Extras" application) by the operating system, but there is no way for you to get a token for a specific image. What are you trying to achieve? Are you creating a Silverlight or XNA application?
You may find the following resources useful:
WP7–Adding to the Image Hub 'extras' menu
WP7 Saving to Media Library

Resources