# -*- coding: iso-8859-1 -*- u""" MoinMoin - YouTube macro Version 0.6 Displays an embedded object with the wanted video or displays a list of videos (videobar). <> Default is to use the current pagename as keyword. Examples: * <> * <> * <> @copyright: 2008 by MarcelHäfner (http://moinmo.in/MarcelHäfner), 2010 by ThomasWaldmann (http://moinmo.in/ThomasWaldmann) @license: GNU GPL, see COPYING for details. Attention! The "keyword" part is created with the "Google AJAX Search API Tools". Licence Information can be viewed under: http://code.google.com/intl/de-DE/apis/ajaxsearch/terms.html @TODO: * Change the hardcoded https string into http/https depending on the requested url. * Don't use the google ajax stuff. * Check if youtube videos are disabled (mimetypes_xss). """ from MoinMoin import wikiutil def macro_YouTube(macro, id, keyword): request = macro.request _ = request.getText html = u"" if id is None and keyword is None: # default: keyword will be used and default to current page name keyword = macro.formatter.page.page_name if keyword is not None: # for the videobar to display the flash videos (keyword) parameters = { "keyword": wikiutil.escape(keyword), "msg_youtubelink": _("View the related videos on YouTube."), } html = u"""
Loading...
""" % parameters if id is not None: # for the embedded flashplayer to play a single video (id) parameters = { "id": wikiutil.escape(id), "msg_youtubelink": _("View the video on YouTube."), } html = u""" """ % parameters return macro.formatter.rawHTML(html)