Ejemplo n.º 1
0
def swf_generator(url, width):
    ''' A quick check for the right url, this one requires a direct
    swf link:

      >>> print swf_generator('http://somehost.com/file/get/SomeVideo.swf', width=400)
      <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="320" id="Untitled-1" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="http://somehost.com/file/get/SomeVideo.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="http://somehost.com/file/get/SomeVideo.swf" quality="high" bgcolor="#ffffff" width="400" height="320" name="video" align="middle" allowScriptAccess="sameDomain" allowNetworking="all" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /> </object>

    '''

    height = int(round(0.8*width))

    return squeeze_xml(u'''
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
          codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" 
          width="%(width)s" height="%(height)s" id="Untitled-1" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="%(file_url)s" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="%(file_url)s" quality="high" bgcolor="#ffffff"
           width="%(width)s" height="%(height)s" name="video"
           align="middle" allowScriptAccess="sameDomain"
           allowNetworking="all"
           type="application/x-shockwave-flash"
           pluginspage="http://www.adobe.com/go/getflashplayer" />
  </object>
''' % {'file_url': url,
       'width': unicode(width),
       'height': unicode(height)})
Ejemplo n.º 2
0
     <param name="quality" value="best" />
     <param name="wmode" value="window" />
     <embed
        type="application/x-shockwave-flash"
        width="%(width)s"
        height="%(height)s"
        id="shoplayerembed"
        src="http://blip.tv/scripts/flash/showplayer.swf?file=%(file_url)s"
        pluginspage="http://www.macromedia.com/go/getflashplayer"
        wmode="window"
        allowfullscreen="true"
        allowscriptaccess="always"
     />
</object>
'''
EMBED_HTML = squeeze_xml(EMBED_HTML)

def _rss_url(url):
    """Return RSS url for the video url.

      >>> _rss_url('http://someplace.com')
      'http://someplace.com?skin=rss'

      >>> _rss_url('http://someplace.com?arg1=foo')
      'http://someplace.com?arg1=foo&skin=rss'
    """

    host, path, query, fragment = break_url(url)
    file_url = url
    if len(query.keys()) == 0:
        file_url += '?skin=rss'