Integrating ooyala in django (or just python)by jaymz on 14/07/2010
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().embed_code, \ method=O.ANALYTIC_METHODS.VIDEO) ooyala_response = req.process() return HttpResponse(ooyala_response.toprettyxml(), mimetype="text/xml")