djangoembed

Rich media consuming/providing for django
Download

djangoembed Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Publisher Name:
  • Charles Leifer
  • Publisher web site:
  • http://www.charlesleifer.com/blog/

djangoembed Tags


djangoembed Description

Rich media consuming/providing for django djangoembed is a rich media consuming/providing package for the Django framework.InstallationFirst, you need to install OEmbed. It is available at http://github.com/worldcompany/djangoembed/git clone git://github.com/worldcompany/djangoembed/cd djangoembedpython setup.py installAdding to your Django ProjectAfter installing, adding OEmbed consumption to your projects is a snap. First, add it to your projects' INSTALLED_APPs and run 'syncdb':# settings.pyINSTALLED_APPS = djangoembed uses a registration pattern like the admin's. In order to be sure all apps have been loaded, djangoembed should run autodiscover() in the urls.py. If you like, you can place this code right below your admin.autodiscover() bits:# urls.pyimport oembedoembed.autodiscover()Consuming ResourcesNow you're ready to start consuming OEmbed-able objects. There are a couple of options depending on what you want to do. The most straightforward way to get up-and-running is to add it to your templates:{% load oembed_tags %}{% oembed %}blog.content{% endoembed %}{# or use the filter #}{{ blog.content|oembed }}{# maybe you're working with some dimensional constraints #}{% oembed "600x600" %}blog.content{% endoembed %}{{ blog.content|oembed:"600x600" }}You can consume oembed objects in python as well:import oembedoembed.autodiscover()# just get the metadataresource = oembed.site.embed('http://www.youtube.com/watch?v=nda_OSWeyn8')resource.get_data(){u'author_name': u'botmib', u'author_url': u'http://www.youtube.com/user/botmib', u'height': 313, u'html': u'< object width="384" height="313" >< param name="movie" value="http://www.youtube.com/v/nda_OSWeyn8&fs=1" >< /param >< param name="allowFullScreen" value="true" >< /param >< param name="allowscriptaccess" value="always" >< /param >< embed src="http://www.youtube.com/v/nda_OSWeyn8&fs=1" type="application/x-shockwave-flash" width="384" height="313" allowscriptaccess="always" allowfullscreen="true" >< /embed >< /object >', u'provider_name': u'YouTube', u'provider_url': u'http://www.youtube.com/', u'title': u'Leprechaun in Mobile, Alabama', u'type': u'video', u'version': u'1.0', u'width': 384}# get the metadata and run it through a template for pretty presentationfrom oembed.consumer import OEmbedConsumerclient = OEmbedConsumer()embedded = client.parse_text("http://www.youtube.com/watch?v=nda_OSWeyn8")< div class="oembed oembed-video provider-youtube" > < object width="384" height="313" > < param name="movie" value="http://www.youtube.com/v/nda_OSWeyn8&fs=1" >< /param > < param name="allowFullScreen" value="true" >< /param > < param name="allowscriptaccess" value="always" >< /param > < embed src="http://www.youtube.com/v/nda_OSWeyn8&fs=1" type="application/x-shockwave-flash" width="384" height="313" allowscriptaccess="always" allowfullscreen="true" > < /embed > < /object > < p class="credit" > < a href="http://www.youtube.com/watch?v=nda_OSWeyn8" >Leprechaun in Mobile, Alabama< /a > by < a href="http://www.youtube.com/user/botmib" >botmib< /a > < /p >< /div >' Requirements: · Python · django-oembed


djangoembed Related Software