Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/misaelnieto/p4a.videoembed
Version personal de pruebas para p4a.videoembed
https://github.com/misaelnieto/p4a.videoembed
Last synced: 1 day ago
JSON representation
Version personal de pruebas para p4a.videoembed
- Host: GitHub
- URL: https://github.com/misaelnieto/p4a.videoembed
- Owner: misaelnieto
- Created: 2010-07-22T18:38:49.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-07-22T19:18:48.000Z (over 14 years ago)
- Last Synced: 2024-11-11T11:11:55.663Z (2 months ago)
- Language: Python
- Homepage: http://svn.plone.org/svn/collective/p4a/p4a.videoembed/
- Size: 191 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
Awesome Lists containing this project
README
p4a.videoembed Package Readme
=============================Overview
--------A registry and adapters for converting urls for various video sharing sites
into embed codes.This package provides some functions and zope3 components for converting urls
from common streaming video sites into embed codes. The purpose is to allow
for content types that provide a user entered url to display embeded video
based on that url. This is to avoid allowing users to enter raw html embed
codes which is potentially dangerous and cumbersome. It also allows for
dynamic scaling of the generated embed code to fit with your page layout.Components
----------At the heart of this product is a set of named adapters. These adapters adapt
a string (url) and an integer (width) and return a unicode embed code.
Currently, adapters are provided for the following video sharing sites:* YouTube http://www.youtube.com/
* Google Video http://video.google.fr
* Yahoo Video http://video.yahoo.com/
* Revver (both http://revver.com and one.revver.com)
* Vimeo http://vimeo.com
* Vmix http://vmix.com
* Blip.tv http://blip.tv
* iFilm http://ifilm.com
* MySpace http://vids.myspace.com
* MetaCafe http://metacafe.com
* College Humor http://collegehumor.com
* Veoh http://veoh.com
* flash video (.flv) using http://www.longtailvideo.com/players/jw-flv-player
* (.mov .qt .m4v) ># The original revver QT embed
* VH1 http://vh1.com
* Live Leak http://liveleak.com
* Video detective http://videodetective.com
* Dailymotion http://www.dailymotion.comBut adding more is as simple as creating a function that checks if the url
is appropriate for the site you want, and another to convert it into an
embed code. You register the latter function as a named adapter, like:
And register the url checking function as a utility with the same
name:
You may optionally provide an integer 'index' as an attribute of the
checker to determine the relative order in which the check is made
(more specific checks should go earlier).Getting the Embed Code
----------------------There are a couple ways to generate an embed code, depending on your usecase.
The easiest is single adaptation of a url:from p4a.videoembed.interfaces import IEmbedCode
embed_code = IEmbedCode(url)This gives an embed of a preset width (425px), to get a custom width, you
multiadapt:from zope.component import getMultiAdapter
embed_code = getMultiAdapter((url, width), IEmbedCode)There is also a convenient view provided for use from restricted code, it
optionally takes a url and width and returns an embed code. If the url
is omitted, then it will try and get one from the context by adapting to
ILinkProvider (which indicates the presence of a getLink method).
Sponsor: The Daily Reel http://www.thedailyreel.com