Пример #1
0
def generate_html(out, fname, seekbar=True, loop=True):
    parser = SWFParser()
    parser.open(fname, header_only=True)
    (x, width, y, height) = parser.rect
    basename = os.path.basename(fname)
    (title, ext) = os.path.splitext(basename)
    out.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">\n'
              '<html>\n<head>\n<title>%s</title>' % title)
    if seekbar:
        out.write(SEEKBAR_HEADER)
    else:
        out.write(NORMAL_HEADER)
    dic = {
        'title': title,
        'width': int(width / 20),
        'height': int(height / 20),
        'basename': basename,
        'swf_version': parser.swf_version,
        'loop': loop,
        'pyvnc2swf_version': PYVNC2SWF_VERSION
    }
    out.write(
        '<h1>%(title)s</h1>\n'
        '<hr noshade><center>\n'
        '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="%(width)d" height="%(height)d"\n'
        ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=%(swf_version)d,0,0,0">\n'
        ' <param name="movie" value="%(basename)s">\n'
        ' <param name="play" value="true">\n'
        ' <param name="loop" value="%(loop)s">\n'
        ' <param name="quality" value="high">\n'
        '<embed src="%(basename)s" width="%(width)d" height="%(height)d" play="true"\n'
        ' loop="%(loop)s" quality="high" type="application/x-shockwave-flash"\n'
        ' pluginspage="http://www.macromedia.com/go/getflashplayer">\n'
        '</embed></object></center>\n'
        '<hr noshade>\n'
        '<div align=right>\n'
        '<em>Generated by <a href="http://www.unixuser.org/~euske/vnc2swf/">pyvnc2swf</a>-%(pyvnc2swf_version)s</em>\n'
        '</div></body></html>\n' % dic)
    return