I'm Jaymz Campbell, developer at u-dox.com. I use Linux with KDE, code a lot of python and shell stuff and basically live on the internet for all intents and purposes. If I'm not coding I'm maybe reading some math papers or comics. Irish born, living in London and writes "american" thanks to the C ansi standard, the W3C and bittorrent.

Integrating ooyala in django (or just python)

Posted: July 14th, 2010 | Author: jaymz | Filed under: code, open source | Tags: , , | 1 Comment »

Ooyala is a feature rich video hosting platform. Something I needed recently was some way to link the data over at ooyala into a django site I’m building. So I wrote myself a library. It’s available over at github and it’s called (predictably) django-ooyala. Currently there is a management command syncooyala to pull in all the data using the Backlot Query API. These imported items are then linked to a specific URL. Finally in your templates there is a ooyala_video tag which when given the current path (via request.path) returns the <script> tags needed for it to render.

Expect some updates as I flesh it out into the front end over the next few days.

Updated (11th August): I have added in analytics support. You can now make requests for video stat’s for a given account or video. The facebook SDK has also been added with a new template tag to output the headers in your template for a given video. Remember to request whitelisting from facebook for SWF embeds to work.

from django.http import HttpResponse
from ooyala.library import OoyalaAnalytics
from ooyala.constants import OoyalaConstants as O
from ooyala.models import OoyalaItem
 
def backlot_query(request):
    req = OoyalaAnalytics(video=OoyalaItem.objects.all()[0].embed_code, \
        method=O.ANALYTIC_METHODS.VIDEO)
    ooyala_response = req.process()
    return HttpResponse(ooyala_response.toprettyxml(), mimetype="text/xml")

One Comment on “Integrating ooyala in django (or just python)”

  1. 1 Tweets that mention Integrating ooyala in django (or just python) — jaymz.eu -- Topsy.com said at 1:29 am on July 15th, 2010:

    [...] This post was mentioned on Twitter by ooyala, Luke. Luke said: @jaymzcampbell Very cool! Integrating ooyala in django (or just python) http://bit.ly/9ZiDMy Nice work Jaymz. [...]


Leave a Reply