Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 """Wizard plugin for the cortado http plug 23 """ 24 25 import gettext 26 from zope.interface import implements 27 28 from flumotion.admin.assistant.interfaces import IHTTPConsumerPlugin, \ 29 IHTTPConsumerPluginLine 30 from flumotion.admin.assistant.models import HTTPServer, HTTPPlug 31 from flumotion.ui.plugarea import WizardPlugLine 32 33 _ = gettext.gettext 34 35 __version__ = "$Rev$" 36 37 # Copied from posixpath.py 38 3941 """Join two or more pathname components, inserting '/' as needed""" 42 path = a 43 for b in p: 44 if b.startswith('/'): 45 path = b 46 elif path == '' or path.endswith('/'): 47 path += b 48 else: 49 path += '/' + b 50 return path51 5254 """I am a model representing the configuration file for a 55 Cortado HTTP streaming plug. 56 """ 57 plugType = "component-cortado" 58 59 # Component 6080 8162 p = super(CortadoHTTPPlug, self).getProperties() 63 64 p.codebase = self.server.getCodebase() 65 p.stream_url = self.streamer.getURL() 66 p.has_video = self.videoProducer is not None 67 p.has_audio = self.audioProducer is not None 68 69 width = 320 70 height = 240 71 if self.videoProducer: 72 width = self.videoProducer.properties.width 73 height = self.videoProducer.properties.height 74 75 p.width = width 76 p.height = height 77 p.buffer_size = 40 78 79 return p83 """I am a model representing the configuration file for a 84 HTTP server component which will be used to serve a cortado 85 java applet. 86 Most of the interesting logic here is actually in a plug. 87 """ 88 componentType = 'http-server' 89131 13291 """ 92 @param streamer: streamer 93 @type streamer: L{HTTPStreamer} 94 @param audioProducer: audio producer 95 @type audioProducer: L{flumotion.admin.assistant.models.AudioProducer} 96 subclass or None 97 @param videoProducer: video producer 98 @type videoProducer: L{flumotion.admin.assistant.models.VideoProducer} 99 subclass or None 100 @param mountPoint: 101 @type mountPoint: 102 """ 103 self.streamer = streamer 104 105 super(CortadoHTTPServer, self).__init__(mountPoint=mountPoint, 106 worker=streamer.worker) 107 108 porter = streamer.getPorter() 109 self.properties.porter_socket_path = porter.getSocketPath() 110 self.properties.porter_username = porter.getUsername() 111 self.properties.porter_password = porter.getPassword() 112 self.properties.port = porter.getPort() 113 self.properties.type = 'slave' 114 plug = CortadoHTTPPlug(self, streamer, audioProducer, videoProducer) 115 self.addPlug(plug)116118 """Returns the base of directory of the applet 119 @returns: directory 120 """ 121 return 'http://%s:%d%s' % (self.streamer.hostname, 122 self.properties.port, 123 self.properties.mount_point)124126 properties = super(CortadoHTTPServer, self).getProperties() 127 hostname = self.streamer.getHostname() 128 if hostname: 129 properties.hostname = hostname 130 return properties134 implements(IHTTPConsumerPluginLine) 135 gladeFile = '' 136 inactiveMessage = \ 137 _('Cortado player should be installed to enable this option') 138 142 145150 151147 mountPoint = slashjoin(streamer.properties.mount_point, "cortado/") 148 return CortadoHTTPServer(streamer, audioProducer, 149 videoProducer, mountPoint)153 implements(IHTTPConsumerPlugin) 154 157167 170159 d = self.wizard.runInWorker( 160 worker, 161 'flumotion.worker.checks.cortado', 'checkCortado') 162 163 def check(found): 164 return bool(found)165 d.addCallback(check) 166 return d
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Jun 17 12:33:52 2011 | http://epydoc.sourceforge.net |