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) 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 import gettext 23 import os 24 25 import gobject 26 import gtk 27 28 from zope.interface import implements 29 30 from flumotion.configure import configure 31 from flumotion.common import errors, messages 32 from flumotion.common.i18n import N_, gettexter 33 from flumotion.admin.gtk.basesteps import AudioProducerStep, VideoProducerStep 34 from flumotion.admin.assistant.interfaces import IProducerPlugin 35 from flumotion.admin.assistant.models import AudioProducer, VideoProducer, \ 36 AudioEncoder, VideoEncoder, VideoConverter 37 from flumotion.ui.fileselector import FileSelectorDialog 38 39 __pychecker__ = 'no-returnvalues' 40 __version__ = "$Rev: 6583 $" 41 _ = gettext.gettext 42 T_ = gettexter('flumotion') 43 4446 componentType = 'loop-producer' 4762 6349 super(LoopProducer, self).__init__() 50 self.properties.location = None 51 self.properties.framerate = 5.0 52 self.properties.width = 320 53 self.properties.height = 2405456 if isinstance(component, AudioEncoder): 57 return 'audio' 58 elif isinstance(component, (VideoEncoder, VideoConverter)): 59 return 'video' 60 else: 61 raise AssertionError65 icon = 'looper.png' 66 componentType = 'filesrc' 67 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 68 'wizard.glade') 69 70 _mimetype = 'application/ogg' 71 _audio_required = True 72 _video_required = True 73 77 81 84 87117 122 126 130 135 140 141 fs = FileSelectorDialog(self.wizard.window, 142 self.wizard.getAdminModel()) 143 144 fs.connect('response', response_cb) 145 fs.connect('delete-event', deleteEvent) 146 fs.selector.setWorkerName(self.model.worker) 147 fs.selector.setOnlyDirectoriesMode(False) 148 if location: 149 directory = os.path.dirname(location) 150 else: 151 directory = '/' 152 fs.selector.setDirectory(directory) 153 fs.show_all() 154 15789 self._blockNext[id] = True 90 if location is None or location == '': 91 self._verify() 92 return 93 self.wizard.waitForTask('looper location check') 94 95 def checkFileFinished(result): 96 validFile, properties = result 97 if not validFile: 98 message = messages.Warning(T_(N_( 99 "'%s' is not a valid file, " 100 "or is not readable on worker '%s'.") 101 % (location, self.worker))) 102 message.id = 'looper-'+id+'-check' 103 self.wizard.add_msg(message) 104 else: 105 self._updateFileProperties(properties) 106 self.wizard.clear_msg('looper-'+id+'-check') 107 self._blockNext[id] = False 108 self.wizard.taskFinished() 109 self._verify()110 d = self.runInWorker('flumotion.worker.checks.check', 111 'checkMediaFile', 112 location, 113 self._mimetype, 114 self._audio_required, 115 self._video_required) 116 d.addCallback(checkFileFinished)159 160 def response(fs, response): 161 fs.hide() 162 if response == gtk.RESPONSE_OK: 163 self.model.properties.location = fs.getFilename() 164 self._proxy.update('location') 165 self._clearMessage('location') 166 self._runFileCheck(self.model.properties.location, 'location')167 168 self._showFileSelector(response, 169 self.model.properties.location) 170 175 176178 title = _('Loop Video') 179 name = 'Loop Video' 180 184205 206186 self._audio_required = False 187 self.location.data_type = str 188 self.width.data_type = int 189 self.height.data_type = int 190 self.framerate.data_type = float 191 self._proxy = self.add_proxy(self.model.properties, 192 ['width', 'height', 193 'framerate', 'location'])194196 self.model.properties.width = props.get('width', 197 self.model.properties.width) 198 self.model.properties.height = props.get('height', 199 self.model.properties.height) 200 self.model.properties.framerate = props.get('framerate', 201 self.model.properties.framerate) 202 self._proxy.update('width') 203 self._proxy.update('height') 204 self._proxy.update('framerate')208 name = 'Loop audio' 209 title = _('Loop audio') 210 214229 230216 self._video_required = False 217 self.location.data_type = str 218 self._proxy = self.add_proxy(self.model.properties, ['location']) 219 self.video.hide() 220 videoProducer = self.wizard.getStep('Production').getVideoProducer() 221 if not videoProducer or videoProducer.componentType != 'loop-producer': 222 self.location_box.set_sensitive(True) 223 else: 224 self.location.set_text(videoProducer.properties.location) 225 self.location_box.set_sensitive(False)226232 implements(IProducerPlugin) 233 236242238 if type == 'audio': 239 return LoopAudioStep(self.wizard, LoopProducer()) 240 elif type == 'video': 241 return LoopVideoStep(self.wizard, LoopProducer())
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Sep 24 12:47:10 2010 | http://epydoc.sourceforge.net |