def registerApp(fileName): import AccessGrid.Toolkit as Toolkit app = Toolkit.CmdlineApplication() appdb = app.GetAppDatabase() fn = os.path.basename(fileName) exeCmd = sys.executable + " " + fn + " -a %(appUrl)s" # Call the registration method on the applications database #appdb.RegisterApplication("Shared Covise", # "application/x-ag-shared-covise", # "sharedcovise", # {"Open" : exeCmd }, # [fn], os.getcwd()) # old init have to be changed soon uad = Platform.GetUserAppPath() src = os.path.abspath(fn) dest = os.path.join(uad, fn) exeCmd = sys.executable + " \"" + dest + "\" -a %(appUrl)s" print("hallo" + src + " to " + dest) try: shutil.copyfile(src, dest) except IOError: print "could not copy app into place" sys.exit(1) # Call the registration method on the applications database appdb.RegisterApplication("Shared Covise", "application/x-ag-covise", "sharedcovise", {"Open": exeCmd})
def __SetRTPDefaults(self, profile): """ Set values used by rat for identification """ if profile == None: self.log.exception("Invalid profile (None)") raise Exception, "Can't set RTP Defaults without a valid profile." if Platform.isLinux() or Platform.isFreeBSD() or Platform.isOSX(): try: rtpDefaultsFile = os.path.join(os.environ["HOME"], ".RTPdefaults") rtpDefaultsText = "*rtpName: %s\n*rtpEmail: %s\n*rtpLoc: %s\n*rtpPhone: \ %s\n*rtpNote: %s\n" rtpDefaultsFH = open(rtpDefaultsFile, "w") rtpDefaultsFH.write( rtpDefaultsText % (profile.name, profile.email, profile.location, profile.phoneNumber, profile.publicId)) rtpDefaultsFH.close() except: self.log.exception("Error writing RTP defaults file: %s", rtpDefaultsFile) elif Platform.isWindows(): try: # Set RTP defaults according to the profile k = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, r"Software\Mbone Applications\common") # Rat reads these (without '*') _winreg.SetValueEx(k, "rtpName", 0, _winreg.REG_SZ, profile.name) _winreg.SetValueEx(k, "rtpEmail", 0, _winreg.REG_SZ, profile.email) _winreg.SetValueEx(k, "rtpPhone", 0, _winreg.REG_SZ, profile.phoneNumber) _winreg.SetValueEx(k, "rtpLoc", 0, _winreg.REG_SZ, profile.location) _winreg.SetValueEx(k, "rtpNote", 0, _winreg.REG_SZ, str(profile.publicId)) _winreg.CloseKey(k) except: self.log.exception("Error writing RTP defaults to registry")
def __SetRTPDefaults(self, profile): """ Set values used by rat for identification """ if profile == None: self.log.exception("Invalid profile (None)") raise Exception, "Can't set RTP Defaults without a valid profile." if Platform.isLinux() or Platform.isFreeBSD() or Platform.isOSX(): try: rtpDefaultsFile=os.path.join(os.environ["HOME"], ".RTPdefaults") rtpDefaultsText="*rtpName: %s\n*rtpEmail: %s\n*rtpLoc: %s\n*rtpPhone: \ %s\n*rtpNote: %s\n" rtpDefaultsFH=open( rtpDefaultsFile,"w") rtpDefaultsFH.write( rtpDefaultsText % ( profile.name, profile.email, profile.location, profile.phoneNumber, profile.publicId ) ) rtpDefaultsFH.close() except: self.log.exception("Error writing RTP defaults file: %s", rtpDefaultsFile) elif Platform.isWindows(): try: # Set RTP defaults according to the profile k = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, r"Software\Mbone Applications\common") # Rat reads these (without '*') _winreg.SetValueEx(k, "rtpName", 0, _winreg.REG_SZ, profile.name) _winreg.SetValueEx(k, "rtpEmail", 0, _winreg.REG_SZ, profile.email) _winreg.SetValueEx(k, "rtpPhone", 0, _winreg.REG_SZ, profile.phoneNumber) _winreg.SetValueEx(k, "rtpLoc", 0, _winreg.REG_SZ, profile.location) _winreg.SetValueEx(k, "rtpNote", 0, _winreg.REG_SZ, str(profile.publicId) ) _winreg.CloseKey(k) except: self.log.exception("Error writing RTP defaults to registry")
def __setProperties(self): # Fix for OS X where wx.DEFAULT isn't sane pointSize = wx.DEFAULT if Platform.IsOSX(): pointSize = 12 self.info1.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.info3.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD)) self.info5.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD))
def saveConfig(self): userapp = Platform.GetUserAppPath() configFileName = userapp + "\\SharedCovise.config" configFile = None try: configFile = file(configFileName, 'w') except: print "could no save config file" if configFile != None: configFile.write(self.hostName + "\n") configFile.write(str(self.serverPort) + "\n")
def pageFile(self, file, pager): try: dot = file.rindex(".") ext = file[dot + 1:] except ValueError: ext = "" localFile = tempfile.mktemp(ext) try: self.dsc.Download(file, localFile) if Platform.IsWindows() and pager == "more": os.system("more < %s" % (localFile)) else: os.system("%s %s" % (pager, localFile)) os.unlink(localFile) except Exception, e: print "Except! ", e
def IsExecFileAvailable(file, path=None): """ Used to check if a command is available to be executed. Checks directories in the PATH variable are included. On windows, the current directory is included automatically. Note that the exact filename is required -- i.e. "python.exe" will be found on windows, but "python" won't. """ if path == None: path = os.environ['PATH'] # Windows always includes the current directory. if Platform.IsWindows(): separatedPath = path.split(";") separatedPath.append(".") else: separatedPath = path.split(":") for singlePath in separatedPath: fullpath = os.path.join(singlePath, file) #print "Checking full path:", fullpath if os.access(fullpath, os.X_OK): return 1 return 0
def testIWindows(self): Platform.isWindows()
def testIsOSX(self): Platform.isOSX()
def testIsLinux(self): Platform.isLinux()
def __init__(self): AGService.__init__(self) self.thepath = os.getcwd() self.windowGeometry = None self.capabilities = [ Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L16", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "L8", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "PCMU", 8000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 16000, self.id), Capability(Capability.CONSUMER, Capability.AUDIO, "GSM", 8000, self.id), Capability(Capability.PRODUCER, Capability.AUDIO, "L16", 16000, self.id) ] if Platform.IsWindows(): rat = "rat.exe" ratmedia = "ratmedia.exe" ratui = "rat-ui.exe" ratkill = "rat-kill.exe" else: rat = "rat" ratmedia = "ratmedia" ratui = "rat-ui" ratkill = "rat-kill" self.executable = os.path.join(os.getcwd(), rat) self.rat_media = os.path.join(os.getcwd(), ratmedia) self.rat_ui = os.path.join(os.getcwd(), ratui) self.rat_kill = os.path.join(os.getcwd(), ratkill) if not os.path.isfile(self.executable): self.executable = rat self.rat_media = ratmedia self.rat_ui = ratui self.rat_kill = ratkill # For some reason, a full path is need for ratkill for dir in os.getenv("PATH").split(":"): ratkill_fullpath = os.path.join(dir, ratkill) if os.access(ratkill_fullpath, os.X_OK): self.rat_kill = ratkill_fullpath break self.sysConf = SystemConfig.instance() # Set configuration parameters self.talk = OptionSetParameter("Talk", "Off", ["On", "Off"]) self.inputGain = RangeParameter("Input Gain", 50, 0, 100) if Platform.isOSX(): self.outputGain = RangeParameter("Output Gain", 4, 0, 100) else: self.outputGain = RangeParameter("Output Gain", 50, 0, 100) self.silenceSuppression = OptionSetParameter( "Silence Suppression", "Off", ["Off", "Automatic", "Manual"]) self.positionWindow = OptionSetParameter( 'Position Window', 'Off', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append(self.talk) self.configuration.append(self.inputGain) self.configuration.append(self.outputGain) self.configuration.append(self.silenceSuppression) self.configuration.append(self.positionWindow) if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms self.forceOSSAC97 = OptionSetParameter("Force AC97", "False", ["True", "False"]) self.configuration.append(self.forceOSSAC97) self.useSiteId = OptionSetParameter("Use site id", "On", ["On", "Off"]) self.configuration.append(self.useSiteId) self.profile = None
def Start(self): """Start service""" try: # Initialize environment for rat try: self.__SetRTPDefaults(self.profile) except: self.log.exception("Error setting RTP defaults") self.WriteRatDefaults() if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms if self.forceOSSAC97.value == "True": self.log.info("Setting OSS_IS_AC97 = 1") os.environ['OSS_IS_AC97'] = "1" # Enable firewall self.sysConf.AppFirewallConfig(self.executable, 1) self.sysConf.AppFirewallConfig(self.rat_media, 1) self.sysConf.AppFirewallConfig(self.rat_ui, 1) self.sysConf.AppFirewallConfig(self.rat_kill, 1) # Start the service; # in this case, store command line args in a list and let # the superclass _Start the service options = [] if self.streamDescription.name and \ len(self.streamDescription.name.strip()) > 0: options.append("-C") if Platform.isLinux() or Platform.isFreeBSD( ) or Platform.isOSX(): # Rat doesn't like spaces in linux command line arguments. stream_description_no_spaces = string.replace( self.streamDescription.name, " ", "_") options.append(stream_description_no_spaces) else: options.append(self.streamDescription.name) # pass public id as site id if self.useSiteId.value == 'On' and self.profile: # site id not supported in UCL rat yet, which is used on macs. options.append("-S") options.append(self.profile.publicId) if not self.positionWindow.value == 'Off': try: if not self.windowGeometry: h = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) self.windowGeometry = (h - 375) if self.positionWindow.value == 'Justify Left': options.append("-Xgeometry=300x300+400+%d" % self.windowGeometry) else: options.append("-Xgeometry=300x300-400+%d" % self.windowGeometry) except: self.log.exception('Error calculating window placement') options.append("-f") if Platform.isOSX(): #options.append( "L16-8K-Mono" ) # prevent mac mash converter # # issues (at least on this G5). # 3.2 shipped with OpenAL-based RAT which performs well at 16K options.append("L16-16K-Mono") else: options.append("L16-16K-Mono") # Check whether the network location has a "type" # attribute Note: this condition is only to maintain # compatibility between older venue servers creating # network locations without this #attribute and newer # services relying on the attribute; it should be removed # when the incompatibility is gone if self.streamDescription.location.__dict__.has_key("type"): if self.streamDescription.location.type == MulticastNetworkLocation.TYPE: options.append("-t") options.append('%d' % (self.streamDescription.location.ttl)) if self.streamDescription.encryptionFlag != 0: options.append("-crypt") options.append(self.streamDescription.encryptionKey) options.append('%s/%d' % (self.streamDescription.location.host, self.streamDescription.location.port)) self.log.info("Starting AudioService") self.log.info(" executable = %s" % self.executable) self.log.info(" options = %s" % options) os.chdir(self.thepath) self._Start(options) except: self.log.exception("Exception in AudioService.Start") raise Exception("Failed to start service")
def WriteRatDefaults(self): if Platform.isWindows(): # Write defaults into registry try: key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Mbone Applications\\rat") if self.talk.value == "On": mute = 0 else: mute = 1 _winreg.SetValueEx(key, "audioInputMute", 0, _winreg.REG_DWORD, mute) _winreg.SetValueEx(key, "audioInputGain", 0, _winreg.REG_DWORD, self.inputGain.value) _winreg.SetValueEx(key, "audioOutputGain", 0, _winreg.REG_DWORD, self.outputGain.value) _winreg.SetValueEx(key, "audioSilence", 0, _winreg.REG_SZ, self.silenceSuppression.value) _winreg.CloseKey(key) except: self.log.exception("Couldn't put rat defaults in registry.") elif Platform.isLinux() or Platform.isOSX() or Platform.isFreeBSD(): ratDefaultsFile = os.path.join(os.environ["HOME"], ".RATdefaults") ratDefaults = dict() # Read file first, to preserve settings therein if os.access(ratDefaultsFile, os.R_OK): f = open(ratDefaultsFile, "r") lines = f.readlines() for line in lines: line = line.strip() if line: try: k, v = line.split(':', 1) ratDefaults[k] = v except: self.log.exception( 'Error processing rat defaults line: %s', line) f.close() # Update settings if self.talk.value == "On": mute = 0 else: mute = 1 ratDefaults["*audioInputMute"] = str(mute) ratDefaults["*audioInputGain"] = str(self.inputGain.value) ratDefaults["*audioOutputGain"] = str(self.outputGain.value) ratDefaults["*audioSilence"] = str(self.silenceSuppression.value) # Write file with these settings f = open(ratDefaultsFile, "w") for k, v in ratDefaults.items(): f.write("%s: %s\n" % (k, v)) f.close() else: raise Exception("Unknown platform: %s" % sys.platform)
def WriteRatDefaults(self): if Platform.isWindows(): # Write defaults into registry try: key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER, "Software\\Mbone Applications\\rat") if self.talk.value == "On": mute = 0 else: mute = 1 _winreg.SetValueEx(key, "audioInputMute", 0, _winreg.REG_DWORD, mute) _winreg.SetValueEx(key, "audioInputGain", 0, _winreg.REG_DWORD, self.inputGain.value ) _winreg.SetValueEx(key, "audioOutputGain", 0, _winreg.REG_DWORD, self.outputGain.value ) _winreg.SetValueEx(key, "audioSilence", 0, _winreg.REG_SZ, self.silenceSuppression.value ) _winreg.CloseKey(key) except: self.log.exception("Couldn't put rat defaults in registry.") elif Platform.isLinux() or Platform.isOSX() or Platform.isFreeBSD(): ratDefaultsFile = os.path.join(os.environ["HOME"],".RATdefaults") ratDefaults = dict() # Read file first, to preserve settings therein if os.access(ratDefaultsFile, os.R_OK): f = open(ratDefaultsFile,"r") lines = f.readlines() for line in lines: line = line.strip() if line: try: k,v = line.split(':',1) ratDefaults[k] = v except: self.log.exception('Error processing rat defaults line: %s', line) f.close() # Update settings if self.talk.value == "On": mute = 0 else: mute = 1 ratDefaults["*audioInputMute"] = str(mute) ratDefaults["*audioInputGain"] = str(self.inputGain.value ) ratDefaults["*audioOutputGain"] = str(self.outputGain.value ) ratDefaults["*audioSilence"] = str(self.silenceSuppression.value ) # Write file with these settings f = open(ratDefaultsFile, "w") for k,v in ratDefaults.items(): f.write("%s: %s\n" % (k,v) ) f.close() else: raise Exception("Unknown platform: %s" % sys.platform)
def __init__(self, arg, url, log=None): wxApp.__init__(self, arg) """ This is the constructor for the Shared Covise. """ # Initialize state in the shared covise self.url = url self.eventQueue = Queue.Queue(5) self.log = log self.masterId = None self.numSteps = 0 self.hostName = "vision.rus.uni-stuttgart.de" self.serverPort = 31098 self.masterSocket = None # Get a handle to the application object in the venue self.log.debug("Getting application proxy (%s).", url) self.appProxy = Client.Handle(self.url).GetProxy() # Join the application object, get a private ID in response self.log.debug("Joining application.") (self.publicId, self.privateId) = self.appProxy.Join() # Get the information about our Data Channel self.log.debug("Retrieving data channel information.") (self.channelId, esl) = self.appProxy.GetDataChannel(self.privateId) # Connect to the Data Channel, using the EventClient class # The EventClient class is a general Event Channel Client, but since # we use the Event Channel for a Data Channel we can use the # Event Client Class as a Data Client. For more information on the # Event Channel look in AccessGrid\EventService.py # and AccessGrid\EventClient.py self.log.debug("Connecting to data channel.") self.eventClient = EventClient(self.privateId, esl, self.channelId) self.eventClient.start() self.eventClient.Send(ConnectEvent(self.channelId, self.privateId)) # Register callbacks with the Data Channel to handle incoming # events. self.log.debug("Registering for events.") self.eventClient.RegisterCallback(SharedCovEvent.MASTER, self.RecvMaster) self.eventClient.RegisterCallback(SharedCovEvent.CLEAN, self.CleanCovise) self.masterHost = "" self.masterPort = 0 self.masterHost = self.appProxy.GetData(self.privateId, SharedCovKey.MASTERHOST) self.masterPort = self.appProxy.GetData(self.privateId, SharedCovKey.MASTERPORT) self.frame.SetMasterHost(self.masterHost + ":" + str(self.masterPort)) self.log.debug("fit.") self.log.debug("SharedCovise V1.0") # read configueation file userapp = Platform.GetUserAppPath() configFileName = userapp + "\\SharedCovise.config" configFile = None try: configFile = file(configFileName, 'r') except: print "could no open config file" if configFile != None: entry = configFile.readline(200) if entry != "": self.hostName = entry.rstrip("\n") entry = configFile.readline(200) if entry != "": self.serverPort = int(entry) self.frame.SetPort(self.serverPort) self.frame.SetHost(self.hostName) if self.masterHost == self.hostName and self.serverPort == self.serverPort: #connect to our Daemon and find out if covise is still running message = "check" try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.send(message) self.masterSocket = s self.appProxy.SetData(self.privateId, SharedCovKey.MASTERHOST, self.hostName) self.appProxy.SetData(self.privateId, SharedCovKey.MASTERPORT, self.serverPort) self.eventClient.Send( Event(SharedCovEvent.MASTER, self.channelId, (self.publicId, self.publicId))) Thread(target=self.monitorMaster).start() except: self.appProxy.SetData(self.privateId, SharedCovKey.MASTERHOST, "") self.appProxy.SetData(self.privateId, SharedCovKey.MASTERPORT, 0) self.eventClient.Send( Event(SharedCovEvent.MASTER, self.channelId, (self.publicId, self.publicId))) print "could not connect to AccessGridDaemon\n"
def Start( self ): """Start service""" try: # Initialize environment for rat try: self.__SetRTPDefaults(self.profile) except: self.log.exception("Error setting RTP defaults") self.WriteRatDefaults() if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms if self.forceOSSAC97.value == "True": self.log.info("Setting OSS_IS_AC97 = 1") os.environ['OSS_IS_AC97'] = "1" # Enable firewall self.sysConf.AppFirewallConfig(self.executable, 1) self.sysConf.AppFirewallConfig(self.rat_media, 1) self.sysConf.AppFirewallConfig(self.rat_ui, 1) self.sysConf.AppFirewallConfig(self.rat_kill, 1) # Start the service; # in this case, store command line args in a list and let # the superclass _Start the service options = [] if self.streamDescription.name and \ len(self.streamDescription.name.strip()) > 0: options.append( "-C" ) if Platform.isLinux() or Platform.isFreeBSD() or Platform.isOSX(): # Rat doesn't like spaces in linux command line arguments. stream_description_no_spaces = string.replace( self.streamDescription.name, " ", "_") options.append( stream_description_no_spaces ) else: options.append(self.streamDescription.name) # pass public id as site id if self.useSiteId.value == 'On' and self.profile: # site id not supported in UCL rat yet, which is used on macs. options.append("-S") options.append(self.profile.publicId) if not self.positionWindow.value == 'Off': try: if not self.windowGeometry: h = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) self.windowGeometry = (h-375) if self.positionWindow.value == 'Justify Left': options.append( "-Xgeometry=300x300+400+%d" % self.windowGeometry ) else: options.append( "-Xgeometry=300x300-400+%d" % self.windowGeometry ) except: self.log.exception('Error calculating window placement') options.append( "-f" ) if Platform.isOSX(): #options.append( "L16-8K-Mono" ) # prevent mac mash converter # # issues (at least on this G5). # 3.2 shipped with OpenAL-based RAT which performs well at 16K options.append( "L16-16K-Mono" ) else: options.append( "L16-16K-Mono" ) # Check whether the network location has a "type" # attribute Note: this condition is only to maintain # compatibility between older venue servers creating # network locations without this #attribute and newer # services relying on the attribute; it should be removed # when the incompatibility is gone if self.streamDescription.location.__dict__.has_key("type"): if self.streamDescription.location.type == MulticastNetworkLocation.TYPE: options.append( "-t" ) options.append( '%d' % (self.streamDescription.location.ttl ) ) if self.streamDescription.encryptionFlag != 0: options.append( "-crypt" ) options.append( self.streamDescription.encryptionKey ) options.append( '%s/%d' % (self.streamDescription.location.host, self.streamDescription.location.port)) self.log.info("Starting AudioService") self.log.info(" executable = %s" % self.executable) self.log.info(" options = %s" % options) os.chdir(self.thepath) self._Start( options ) except: self.log.exception("Exception in AudioService.Start") raise Exception("Failed to start service")
def SubmitBug(comment, profile, email, logFile=VENUE_CLIENT_LOG): """ Submits a bug to bugzilla. **Parameters** *comment* = Bug description from reporter *profile* = Client Profile describing reporter *email* = Entered email address for support information. If the email is blank, the reporter does not want to be contacted. """ url = "http://bugzilla.mcs.anl.gov/accessgrid/post_bug.cgi" args = {} bugzilla_login = '******' bugzilla_password = '******' args['Bugzilla_login'] = bugzilla_login args['Bugzilla_password'] = bugzilla_password version = '%s %s' % (str(GetVersion()), str(GetStatus())) version = version.strip() args['version'] = version args['rep_platform'] = "Other" # # This detection can get beefed up a lot; I say # NT because I can't tell if it's 2000 or XP and better # to not assume there. # # cf http://www.lemburg.com/files/python/platform.py # if Platform.IsLinux(): args['op_sys'] = "Linux" args['rep_platform'] = "All" # Need a better check for this. elif Platform.IsWindows(): args['op_sys'] = "Windows NT" args['rep_platform'] = "PC" elif Platform.IsOSX(): args['op_sys'] = "MacOS X" args['rep_platform'] = "Macintosh" else: args['op_sys'] = "other" args['priority'] = "P2" args['bug_severity'] = "normal" args['bug_status'] = "NEW" args['assigned_to'] = "" args['cc'] = "*****@*****.**" # email to be cc'd args['bug_file_loc'] = "http://" args['submit'] = " Commit " args['form_name'] = "enter_bug" # Combine comment, profile, and log file information userConfig = Config.UserConfig.instance() # Get config information configData = "\n%s" % userConfig configData += "\n%s\n" % Config.SystemConfig.instance() # Defaults. args['product'] = "Virtual Venues Client Software" args['component'] = "Client UI" logToSearch = None if profile: # Always set profile email to empty string so we don't write # to wrong email address. profile.email = "" profileString = str(profile) else: profileString = "This reporter does not have a client profile" if email == "": # This reporter does not want to be contacted. Do not submit # email address. email = "This reporter does not want to be contacted. No email address specified." def AppendNodeLogs(text): text = text +"\n\n--- ServiceManager.log INFORMATION ---\n\n"+ \ GetLogText(2000, "ServiceManager.log")\ logDir = userConfig.GetLogDir() otherServiceLogs = os.listdir(logDir) for serviceLog in otherServiceLogs: if serviceLog.endswith('Service.log'): text = text \ +"\n\n--- %s INFORMATION ---\n\n" % (serviceLog,) \ +GetLogText(2000, serviceLog) return text commentAndLog = "\n\n--- EMAIL TO CONTACT REPORTER ---\n\n" + str(email) \ +"\n\n--- REPORTER CLIENT PROFILE --- \n\n" + profileString \ +"\n\n--- COMMENT FROM REPORTER --- \n\n" + comment logText = None if logFile == NO_LOG: args['short_desc'] = "Feature or bug report from menu option" elif logFile == VENUE_MANAGEMENT_LOG: args['short_desc'] = "Automatic Bug Report - Venue Management" args['product'] = "Virtual Venue Server Software" args['component'] = "Management UI" logText = GetLogText(10000, "VenueManagement.log") commentAndLog = commentAndLog \ +"\n\n--- VenueManagement.log INFORMATION ---\n\n"+ logText elif logFile == NODE_SETUP_WIZARD_LOG: args['short_desc'] = "Automatic Bug Report - Node Setup Wizard" args['product'] = "Node Management Software" args['component'] = "NodeSetupWizard" logText = GetLogText(10000, "NodeSetupWizard.log") commentAndLog = commentAndLog \ +"\n\n--- NodeSetupWizard.log INFORMATION ---\n\n"+ logText commentAndLog = AppendNodeLogs(commentAndLog) else: args['short_desc'] = "Automatic Bug Report - Venue Client" logToSearch = GetLogText(10000, "VenueClient.log") commentAndLog = commentAndLog \ +"\n\n--- VenueClient.log INFORMATION ---\n\n"+ logToSearch \ commentAndLog = AppendNodeLogs(commentAndLog) # If we've got a logToSearch, look at it to find a exception # at the end. If it has one, mark the component as Certificate # Management. if logToSearch: loc = logToSearch.rfind("Traceback") if loc >= 0: m = re.search(".*Exception.*", logToSearch[loc:]) if m: args['component'] = "Certificate Management" logToSearch = None # Look at the end of the log and guess whether we need to mark this args['comment'] = configData + "\n\n" + commentAndLog # Now submit to the form. params = urllib.urlencode(args) f = urllib.urlopen(url, params) # And read the output. out = f.read() f.close() o = open("out.html", "w") o.write(out) o.close()
def __init__( self ): AGService.__init__( self ) self.thepath = os.getcwd() self.windowGeometry = None self.capabilities = [ Capability( Capability.CONSUMER, Capability.AUDIO, "L16",16000,self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "L16",8000,self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "L8",16000, self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "L8",8000, self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "PCMU", 16000, self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "PCMU",8000, self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "GSM",16000, self.id), Capability( Capability.CONSUMER, Capability.AUDIO, "GSM",8000, self.id), Capability( Capability.PRODUCER, Capability.AUDIO, "L16",16000, self.id)] if Platform.IsWindows(): rat = "rat.exe" ratmedia = "ratmedia.exe" ratui = "rat-ui.exe" ratkill = "rat-kill.exe" else: rat = "rat" ratmedia = "ratmedia" ratui = "rat-ui" ratkill = "rat-kill" self.executable = os.path.join(os.getcwd(), rat) self.rat_media = os.path.join(os.getcwd(), ratmedia) self.rat_ui = os.path.join(os.getcwd(), ratui) self.rat_kill = os.path.join(os.getcwd(), ratkill) if not os.path.isfile(self.executable): self.executable = rat self.rat_media = ratmedia self.rat_ui = ratui self.rat_kill = ratkill # For some reason, a full path is need for ratkill for dir in os.getenv("PATH").split(":"): ratkill_fullpath = os.path.join(dir, ratkill) if os.access(ratkill_fullpath, os.X_OK): self.rat_kill = ratkill_fullpath break self.sysConf = SystemConfig.instance() # Set configuration parameters self.talk = OptionSetParameter( "Talk", "Off", ["On", "Off"] ) self.inputGain = RangeParameter( "Input Gain", 50, 0, 100 ) if Platform.isOSX(): self.outputGain = RangeParameter( "Output Gain", 4, 0, 100 ) else: self.outputGain = RangeParameter( "Output Gain", 50, 0, 100 ) self.silenceSuppression = OptionSetParameter( "Silence Suppression", "Off", ["Off","Automatic","Manual"] ) self.positionWindow = OptionSetParameter( 'Position Window', 'Off', ['Off', 'Justify Left', 'Justify Right']) self.configuration.append(self.talk) self.configuration.append(self.inputGain) self.configuration.append(self.outputGain) self.configuration.append(self.silenceSuppression) self.configuration.append(self.positionWindow) if Platform.isLinux() or Platform.isFreeBSD(): # note: the forceOSSAC97 attribute will only exist for the above platforms self.forceOSSAC97 = OptionSetParameter( "Force AC97", "False", ["True", "False"] ) self.configuration.append(self.forceOSSAC97) self.useSiteId = OptionSetParameter( "Use site id", "On", ["On", "Off"] ) self.configuration.append(self.useSiteId) self.profile = None