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,2009 Fluendo, S.L. 6 # Copyright (C) 2010,2011 Flumotion Services, S.A. 7 # All rights reserved. 8 # 9 # This file may be distributed and/or modified under the terms of 10 # the GNU Lesser General Public License version 2.1 as published by 11 # the Free Software Foundation. 12 # This file is distributed without any warranty; without even the implied 13 # warranty of merchantability or fitness for a particular purpose. 14 # See "LICENSE.LGPL" in the source distribution for more information. 15 # 16 # Headers in this file shall remain intact. 17 18 """Wizard plugin for the cortado http plug 19 """ 20 21 import gettext 22 from zope.interface import implements 23 24 from flumotion.admin.assistant.interfaces import IHTTPConsumerPlugin, \ 25 IHTTPConsumerPluginLine 26 from flumotion.admin.assistant.models import HTTPServer, HTTPPlug 27 from flumotion.ui.plugarea import WizardPlugLine 28 29 _ = gettext.gettext 30 31 __version__ = "$Rev$" 32 33 # Copied from posixpath.py 34 3537 """Join two or more pathname components, inserting '/' as needed""" 38 path = a 39 for b in p: 40 if b.startswith('/'): 41 path = b 42 elif path == '' or path.endswith('/'): 43 path += b 44 else: 45 path += '/' + b 46 return path47 4850 """I am a model representing the configuration file for a 51 Cortado HTTP streaming plug. 52 """ 53 plugType = "component-cortado" 54 55 # Component 5676 7758 p = super(CortadoHTTPPlug, self).getProperties() 59 60 p.codebase = self.server.getCodebase() 61 p.stream_url = self.streamer.getURL() 62 p.has_video = self.videoProducer is not None 63 p.has_audio = self.audioProducer is not None 64 65 width = 320 66 height = 240 67 if self.videoProducer: 68 width = self.videoProducer.properties.width 69 height = self.videoProducer.properties.height 70 71 p.width = width 72 p.height = height 73 p.buffer_size = 40 74 75 return p79 """I am a model representing the configuration file for a 80 HTTP server component which will be used to serve a cortado 81 java applet. 82 Most of the interesting logic here is actually in a plug. 83 """ 84 componentType = 'http-server' 85127 12887 """ 88 @param streamer: streamer 89 @type streamer: L{HTTPStreamer} 90 @param audioProducer: audio producer 91 @type audioProducer: L{flumotion.admin.assistant.models.AudioProducer} 92 subclass or None 93 @param videoProducer: video producer 94 @type videoProducer: L{flumotion.admin.assistant.models.VideoProducer} 95 subclass or None 96 @param mountPoint: 97 @type mountPoint: 98 """ 99 self.streamer = streamer 100 101 super(CortadoHTTPServer, self).__init__(mountPoint=mountPoint, 102 worker=streamer.worker) 103 104 porter = streamer.getPorter() 105 self.properties.porter_socket_path = porter.getSocketPath() 106 self.properties.porter_username = porter.getUsername() 107 self.properties.porter_password = porter.getPassword() 108 self.properties.port = porter.getPort() 109 self.properties.type = 'slave' 110 plug = CortadoHTTPPlug(self, streamer, audioProducer, videoProducer) 111 self.addPlug(plug)112114 """Returns the base of directory of the applet 115 @returns: directory 116 """ 117 return 'http://%s:%d%s' % (self.streamer.hostname, 118 self.properties.port, 119 self.properties.mount_point)120122 properties = super(CortadoHTTPServer, self).getProperties() 123 hostname = self.streamer.getHostname() 124 if hostname: 125 properties.hostname = hostname 126 return properties130 implements(IHTTPConsumerPluginLine) 131 gladeFile = '' 132 inactiveMessage = \ 133 _('Cortado player should be installed to enable this option') 134 138 141146 147143 mountPoint = slashjoin(streamer.properties.mount_point, "cortado/") 144 return CortadoHTTPServer(streamer, audioProducer, 145 videoProducer, mountPoint)149 implements(IHTTPConsumerPlugin) 150 153163 166155 d = self.wizard.runInWorker( 156 worker, 157 'flumotion.worker.checks.cortado', 'checkCortado') 158 159 def check(found): 160 return bool(found)161 d.addCallback(check) 162 return d
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Aug 13 06:17:37 2013 | http://epydoc.sourceforge.net |