Attachment 'YouTube.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - YouTube Macro
   4 
   5     A macro to embed YouTube-videos on wiki pages.
   6     
   7     Usage: [[YouTube(videocode)]]
   8     
   9     Parameters:
  10     
  11     	videocode: The code of the video you want to embed. You find this in the URL given next to the YouTube video.
  12     	
  13     Example:
  14     
  15     	[[YouTube(SWmehf9okWM)]]
  16     	
  17     	The URL given at YouTube looks like this: http://www.youtube.com/watch?v=SWmehf9okWM
  18     
  19     @copyright: 2007 by MoinMoin:RalfZosel 
  20     @license: GNU GPL, see COPYING for details.
  21 """
  22 
  23 from MoinMoin import wikiutil
  24 
  25 def execute(macro, args):
  26     videocode = wikiutil.escape(args)
  27     result = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/%s"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/%s" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>' % (videocode, videocode)
  28     return macro.formatter.rawHTML(result)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-08-14 20:54:19, 1.0 KB) [[attachment:UstreamTv.py]]
  • [get | view] (2007-08-15 19:36:39, 1.2 KB) [[attachment:UstreamTvChat.py]]
  • [get | view] (2007-08-14 20:55:34, 1.0 KB) [[attachment:YouTube.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.