00001
00002 """
00003 MoinMoin - YouTube macro Version 0.1
00004 Displays an emended object with the wanted video
00005
00006 <<YouTube(YouTubeID)>>
00007 Exampel: <<YouTube(2SXKM-dLJV8)>>
00008
00009 @copyright: 2008 by MarcelHäfner (www.heavy.ch)
00010 @license: GNU GPL, see COPYING for details.
00011
00012 """
00013
00014 import re, StringIO
00015 from MoinMoin import wikiutil
00016 _sysmsg = '<p><strong class="%s">%s</strong></p>'
00017
00018 def execute(macro, args):
00019 if not args:
00020 return (_sysmsg % ('error', 'Missing You!',))
00021
00022 params = args.split(",")
00023
00024 link = "%s" % (wikiutil.escape(params[0]),)
00025 width = params[1]
00026 height = params[2]
00027
00028 html= '''<embed type="application/x-shockwave-flash" src="http://media.willowgarage.com/media/jsp/jw_media_player/mediaplayer.swf" width=%(width)s height=%(height)s flashvars="file=http://media.willowgarage.com/media/flv/%(link)s.flv&image=http://media.willowgarage.com/media/thumb/%(link)s?sz=%(width)s,%(height)s&autoStart=false"/>''' % locals()
00029
00030 return macro.formatter.rawHTML(html)
00031