video_script.py :  » Content-Management-Systems » Silva » trunk » codesources » cs_ms_video » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Content Management Systems » Silva 
Silva » trunk » codesources » cs_ms_video » video_script.py
##parameters=ref, controller, autoplay, width='', height=''
# Embeds movies using the Windows Media Player. This Code Source
# was developped to embed *.avi files - therefore it uses the
# clsid of the class ID of the Windows Media Player 6 
# (clsid:05589FA1-C356-11CE-BF01-00AA0055595A) instead of the newer
# ID of the Player versions 7 - 10
# (clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6), which did not work with
# *.avi files. Furthermore it includes 'type="application/x-mplayer2"' in
# the embed tag (the 'video/x-ms-wmv' type would work too, but this Code
# Source explicitely calls for the Windows Media Player). The Windows
# Media Player Plug-in DLL in Firefox does not listen to the extension
# *.avi or its correct MIME-type, 'video/x-msvideo' (or 'video/avi').

model = context.REQUEST.model

if ref.find('://') == -1:
    video = model.restrictedTraverse(str(ref))
    video_url = video.absolute_url()
else:
    video_url = ref

if width == '':
    width_attr = ''
else:
    width_attr = 'width="%s" ' % width

if height == '':
    height_attr = ''
else:
    height_attr = 'height="%s" ' % height

if controller == 'true':
    embed_controller = '1'
else:
    embed_controller = '0'

if autoplay == 'true':
    embed_autoplay = '1'
else:
    embed_autoplay = '0'

return """
<p class="p">
<object %(width_attr)s%(height_attr)s classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A">
  <param name="src" value="%(video_url)s" />
  <param name="autostart" value="%(embed_autoplay)s" />
  <param name="showcontrols" value="%(embed_controller)s" />
  <embed %(width_attr)s%(height_attr)ssrc="%(video_url)s"
    type="application/x-mplayer2" autostart="%(autoplay)s" showcontrols="%(controller)s" />
</object>
</p>
""" % {"width_attr":width_attr, "height_attr":height_attr, "video_url":video_url,
       "embed_autoplay":embed_autoplay, "embed_controller":embed_controller, "autoplay":autoplay, "controller":controller}


#original
#return """
#<p class="p">
#<object %s%s classid="clsid:05589FA1-C356-11CE-BF01-00AA0055595A">
  #<param name="src" value="%s" />
  #<param name="autostart" value="%s" />
  #<param name="showcontrols" value="%s" />
  #<embed %s%ssrc="%s"
    #type="application/x-mplayer2" autostart="%s" showcontrols="%s" />
#</object>
#</p>
#""" % (width_attr, height_attr, video_url, embed_autoplay, embed_controller,
       #width_attr, height_attr, video_url, autoplay, controller)


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.