PK t&k5E  AGVCR_Launcher.appUT  2): try: from twisted.internet import threadedselectreactor threadedselectreactor.install() except: pass from twisted.internet import reactor class AGVCRLauncher(wx.App): global agversion; def __init__(self, appURL, configFile = "", runConfig = 0, debugMode = 0): wx.App.__init__(self, False) self.notifydlg = None self.agVersion = agversion.major if (agversion.major > 2): reactor.interleave(wx.CallAfter) self.progresscount = 0 if not runConfig: self.frame = wx.Frame(None, -1, "AGVCR") try: self.frame.SetIcon(icons.getAGIconIcon()) except: pass self.notifydlg = wx.ProgressDialog("Starting AGVCR", "Initializing", maximum = 7, parent = self.frame, style = wx.PD_APP_MODAL | wx.PD_AUTO_HIDE) self.progresscount = 1 self.notifydlg.CenterOnScreen() self.sharedAppClient = SharedAppClient("AGVCR Launcher") self.log = self.sharedAppClient.InitLogging() self.appURL = appURL self.configFile = configFile self.runConfig = runConfig self.debugMode = debugMode self.appDirectory = "" if Platform.IsWindows(): self.agvcrShell = "agvcr.bat" else: self.agvcrShell = "./agvcr.sh" self.agvcrRunDirectory = os.getcwd() self.netListen = 0 self.hideOutput = 0 # Slashies if Platform.IsWindows(): self.dirSlash = "\\" else: self.dirSlash = "/" # Load configuration file self.updateProgress("Loading configuration file") validConfig = self.loadConfigFile() # Unconfigure default if not validConfig: if Platform.IsWindows(): self.baseDirectory = "C:\\" else: self.baseDirectory = os.environ['HOME'] # Command line overrides if int(debugMode) == 1: self.debugMode == 1 # Normalize the path self.normalizeBaseDir() # Write a default config in place if not validConfig: self.saveConfigFile() def updateProgress(self, msg): if self.notifydlg: self.notifydlg.Update(self.progresscount, msg) self.progresscount = self.progresscount + 1 def normalizeBaseDir(self): # Normalize the path self.baseDirectory = os.path.normpath(self.baseDirectory) if not self.baseDirectory[-1] == self.dirSlash: self.baseDirectory = self.baseDirectory + self.dirSlash def OnInit(self): # Startup return 1 def OnExit(self): # Shutdown self.sharedAppClient.Shutdown() os._exit(1) def displayDebug(self, message): print message self.log.debug(message) def displayError(self, message): self.msgdlg = wx.MessageDialog(self.frame, message, "AGVCR_Launcher", style = wx.OK) self.msgdlg.CenterOnScreen() self.msgdlg.ShowModal() print message self.log.exception(message) def configDialog(self): # Configuration mode self.frame = wx.Frame(None, -1, "AGVCR Launcher " + agvcrlauncher_version + " Configuration") dlg = AGVCRLauncherConfig(self.frame, -1, "AGVCR Launcher " + agvcrlauncher_version + " Configuration", self.baseDirectory, self.debugMode, self.netListen, self.hideOutput, self.appDirectory, pos=(350, 200), size=(500, 200), style = wx.DEFAULT_DIALOG_STYLE) if dlg.ShowModal() == wx.ID_OK: (newBaseDir, newDebugMode, newNetListenEnabled, newNetListen, newhideOutput, newAppDir) = dlg.getSettings() self.baseDirectory = newBaseDir self.appDirectory = newAppDir if newNetListenEnabled: self.netListen = -1 if newNetListen: if int(newNetListen) > 1024: self.netListen = int(newNetListen) else: self.netListen = 0 if newhideOutput: self.hideOutput = 1 else: self.hideOutput = 0 if newDebugMode: self.debugMode = 1 else: self.debugMode = 0 #self.normalizeBaseDir() self.saveConfigFile() def saveConfigFile(self): try: f = open(self.configFile, 'w') except: print "Unable to save configuration file" return 0 else: f.write("basedir = " + str(self.baseDirectory) + "\n") f.write("debug = " + str(self.debugMode) + "\n") f.write("listen = " + str(self.netListen) + "\n") f.write("hideoutput = " + str(self.hideOutput) + "\n") if Platform.IsOSX(): f.write("appdir = " + str(self.appDirectory) + "\n") f.close() def loadConfigFile(self): try: f = open(self.configFile, 'r') except: return 0 else: fileData = str(f.read()) f.close() lines = fileData.splitlines() for lineStr in lines: line = lineStr.split('=') optionName = line[0].strip().lower() if line[1]: optionData = line[1].strip().strip('"') if optionName == "basedir": self.baseDirectory = optionData if optionName == "listen": self.netListen = int(optionData) if optionName == "debug": self.debugMode = int(optionData) if optionName == "hideoutput": self.hideOutput = int(optionData) if Platform.IsOSX(): if optionName == "appdir": self.appDirectory = optionData return 1 def connectToVenue(self): if self.debugMode: self.displayDebug("AGVCR Launcher URL given: " + str(self.appURL)) if not self.appURL: self.displayError("No Application URL given") return 0 # Get client profile. self.updateProgress("Get client profile") try: userConf = UserConfig.instance().GetConfigDir() cpFile = os.path.join(userConf, "profile") self.clientProfile = ClientProfile(cpFile) except: self.displayError("Failed to load client profile.") self.clientProfile = None # Connect to venue self.updateProgress("Connecting to Venue") try: self.sharedAppClient.Join(self.appURL, self.clientProfile) except: self.displayError("Failed to connect to Venue") return 0 self.updateProgress("Getting Venue URL") self.venueUrl = self.sharedAppClient.GetVenueURL() self.updateProgress("Getting Venue streams") self.venueInfo = VenueIW(self.venueUrl) try: self.venueStreams = self.venueInfo.GetStreams() except: self.displayError("Could not get venue stream information from " + str(self.venueUrl)) return 0 if not self.venueStreams: self.displayError("Venue does not have any streams configured.\nMake sure at least one participant has media tools connected.") return 0 if (agversion.major > 2): try: self.venueState = self.venueInfo.GetState() except: self.displayError("Could not get venue state from " + str(self.venueUrl)) return 0 # Ready return 1 def generateCmdLine(self): # AGVCR executable self.updateProgress("Generate command line") # AGVCR Command line arguments self.options = [] networkCryptKey = "" for stream in self.venueStreams: self.options.append(' -s ') if (agversion.major == 2): streamType = stream.capability.type else: streamType = stream.capability[0].type self.options.append('%s/%s/%d/%d' % (str(streamType), str(stream.location.host), stream.location.port, stream.location.ttl)) # Encryption? if stream.encryptionFlag != 0: networkCryptKey = stream.encryptionKey # Default file based on venue name if self.baseDirectory: self.options.append(' -f ') if (agversion.major == 2): venueTitle = self.venueInfo.GetName() else: venueTitle = self.venueState.name self.options.append('"%s' % self.baseDirectory + string.replace(str(venueTitle), " ", "_") + "-" + str(time.strftime("%Y_%m_%d") + '"')) # If we're encrypted.. if networkCryptKey: self.options.append(' -k ') self.options.append('%s' % (networkCryptKey)) # If we're to listen on the network if self.netListen: # Listen on default unless we have a valid port if self.netListen > 1024: self.options.append(' --control=') self.options.append('%s' % (self.netListen)) else: self.options.append(' --control ') if self.debugMode: # Okay, we have our options self.displayDebug("AGVCR options: " + str(self.options)) # Ready return 1 def launchProgram(self): self.updateProgress("Starting AGVCR") if self.appDirectory: self.agvcrRunDirectory = self.appDirectory if Platform.IsOSX(): # Look in the bundle ... if self.appDirectory.endswith(".app"): self.agvcrRunDirectory = self.appDirectory + "/Contents/Resources/" self.agvcrShell = "./script" # Move to directory try: os.chdir(self.agvcrRunDirectory) if self.debugMode: self.displayDebug("Moved to directory:\n" + self.agvcrRunDirectory) except: self.displayDebug("Could not change to " + self.agvcrRunDirectory + " " + strerror) # Set permissions if not Platform.IsWindows(): try: # Make sure shell script is executable os.chmod(self.agvcrShell, 0755) except: # Umm... self.displayError("Could not set executable permissions for shell script" + str(self.agvcrShell)) # ProcessManager doesn't like starting batch files... # The record shows I took the blows - # And did it my way! cmdLineTail = "" if Platform.IsWindows(): cmdOptExtra = "" if self.hideOutput: cmdOptExtra = "/B" try: cmdLine = "start \"AGVCR\" /MIN " + cmdOptExtra + " " + self.agvcrShell except: self.displayError("Could not change to " + runDirectory + " " + strerror) else: if self.hideOutput: cmdLineTail = " 1>/dev/null" cmdLine = self.agvcrShell # The options need to have the spaces in them - since some options # don't want spaces (e.g. '--control=[port]' for optionEntity in self.options: cmdLine = cmdLine + optionEntity # Append anything else cmdLine = cmdLine + cmdLineTail if self.debugMode: self.displayDebug("Running AGVCR as command line:\n" + cmdLine) # Kick it off self.notifydlg.Destroy(); try: x = os.system(cmdLine) signal = x & 0xFF exitcode = (x >> 8) & 0xFF if (exitcode != 0): self.displayError("Problems launching AGVCR\nMost likely problem is that the executable was not found") # Ready return 1 except: self.displayError("Could not run command line" + strerror) # Failed.. return 0 class AGVCRLauncherConfig(wx.Dialog): def __init__(self, parent, ID, title, defBaseDirectory = "", defDebugMode = 0, defNetListen = 0, defHideOutput = 0, defAppDirectory = "", size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE): wx.Dialog.__init__(self, parent, ID, title, size, pos, style) sizerMain = wx.BoxSizer(wx.VERTICAL) sizerButtonBox = wx.BoxSizer(wx.HORIZONTAL) labelInfo = wx.StaticText(self, -1, "AGVCR Launcher " + agvcrlauncher_version + " Configuration") sizerMain.Add(labelInfo, 0, wx.ALIGN_CENTRE|wx.ALL, 3) line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizerMain.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) textBaseDir = wx.StaticText(self, -1, "File Save Directory (must use 'Browse' button)") sizerMain.Add(textBaseDir, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.saveFilesDir = str(defBaseDirectory) self.textBaseDirCtl = wx.TextCtrl(self, -1, self.saveFilesDir, size=(360,-1), style=wx.TE_READONLY) sizerMain.Add(self.textBaseDirCtl, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.ID_BUTTON = wx.NewId() self.browseButton = wx.Button(self, self.ID_BUTTON, "Browse for directory") EVT_BUTTON(self, self.ID_BUTTON, self.selectDir) sizerMain.Add(self.browseButton, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) net_sizer_h = wx.BoxSizer(wx.HORIZONTAL) self.checkBoxNetListen = wx.CheckBox(self, -1, "Listen on network port?") if defNetListen: self.checkBoxNetListen.SetValue(True) net_sizer_h.Add(self.checkBoxNetListen, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) labelNetworkListen = wx.StaticText(self, -1, "Port (optional)") net_sizer_h.Add(labelNetworkListen, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) if int(defNetListen) < 1024: defNetListen = "" self.textNetworkListen = wx.TextCtrl(self, -1, str(defNetListen), size=(50,-1)) net_sizer_h.Add(self.textNetworkListen, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) sizerMain.Add(net_sizer_h, 0, wx.ALIGN_LEFT, 0) labelNetworkListenInfo = wx.StaticText(self, -1, "Port number must be greater than 1024") sizerMain.Add(labelNetworkListenInfo, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.checkBoxHideOutput = wx.CheckBox(self, -1, "Hide console output?") if defHideOutput: self.checkBoxHideOutput.SetValue(True) sizerMain.Add(self.checkBoxHideOutput, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.checkBoxDebugMode = wx.CheckBox(self, -1, "Debug Mode?") if defDebugMode: self.checkBoxDebugMode.SetValue(True) sizerMain.Add(self.checkBoxDebugMode, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.appDir = str(defAppDirectory) if Platform.IsOSX(): textAppDir = wx.StaticText(self, -1, "Location of AGVCR (must use 'Browse' button)") sizerMain.Add(textAppDir, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.appDirCtl = wx.TextCtrl(self, -1, self.appDir, size=(360,-1), style=wx.TE_READONLY) sizerMain.Add(self.appDirCtl, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) self.ID_BUTTON2 = wx.NewId() if Platform.IsOSX(): self.browseAppDirButton = wx.Button(self, self.ID_BUTTON2, "Browse for AGVCR.app") else: self.browseAppDirButton = wx.Button(self, self.ID_BUTTON2, "Browse for AGVCR directory") EVT_BUTTON(self, self.ID_BUTTON2, self.selectAppDir) sizerMain.Add(self.browseAppDirButton, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) line2 = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizerMain.Add(line2, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3) buttonOk = wx.Button(self, wx.ID_OK, " OK ") buttonOk.SetDefault() buttonCancel = wx.Button(self, wx.ID_CANCEL, " Cancel ") sizerButtonBox.Add(buttonOk, 0, wx.ALIGN_CENTRE|wx.ALL, 3) sizerButtonBox.Add(buttonCancel, 0, wx.ALIGN_CENTRE|wx.ALL, 3) sizerMain.Add(sizerButtonBox, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 3) sizerMain.Fit(self) self.SetSizer(sizerMain) self.CenterOnScreen() def selectDir(self, event): dialog = wx.DirDialog (None, message='Choose AGVCR file directory', defaultPath = self.saveFilesDir, style = wx.DD_NEW_DIR_BUTTON) if dialog.ShowModal() == wx.ID_OK: self.saveFilesDir = dialog.GetPath() self.textBaseDirCtl.SetValue(self.saveFilesDir) dialog.Destroy() def selectAppDir(self, event): if Platform.IsOSX(): dialog = wx.FileDialog (None, message='Choose AGVCR .app bundle', defaultDir = self.appDir, defaultFile="AGVCR.app", style = wx.FILE_MUST_EXIST) else: dialog = wx.DirDialog (None, message='Choose AGVCR installation directory', defaultPath = self.appDir, style = wx.DD_NEW_DIR_BUTTON) if dialog.ShowModal() == wx.ID_OK: self.appDir = dialog.GetPath() self.appDirCtl.SetValue(self.appDir) dialog.Destroy() def getSettings(self): return (self.saveFilesDir, self.checkBoxDebugMode.GetValue(), self.checkBoxNetListen.GetValue(), self.textNetworkListen.GetValue(), self.checkBoxHideOutput.GetValue(), self.appDir) class ArgumentManager: def __init__(self): self.arguments = {} self.arguments['applicationURL'] = None self.arguments['configFile'] = 'agvcrlauncher.conf'; self.arguments['runConfigure'] = 0 self.arguments['debug'] = 0 def GetArguments(self): return self.arguments def Usage(self): """ How to use the program. """ print "%s:" % sys.argv[0] print " -a|--applicationURL Application URL in venue" print " -c|--configFile Set the configuration file to use" print " -s|--setConfig Open the configuration dialog" print " -d|--debug Enable debug mode" print " -h|--help Print usage" def ProcessArgs(self): """ Handle any arguments we're interested in. """ try: opts, args = getopt.getopt(sys.argv[1:], "a:c:sdh", ["applicationURL=", "configFile=", "setConfig", "debug", "help"]) except getopt.GetoptError: self.Usage() sys.exit(2) for o, a in opts: if o in ("-a", "--applicationURL"): self.arguments['applicationURL'] = a elif o in ("-c", "--configFile"): self.arguments['configFile'] = a elif o in ("-s", "--setConfig"): self.arguments['runConfigure'] = 1 elif o in ("-d", "--debug"): self.arguments['debug'] = 1 elif o in ("-h", "--help"): self.Usage() sys.exit(0) if __name__ == "__main__": global agMajorVersion, agMinorVersion, agUpdateVersion # Parse command line options am = ArgumentManager() am.ProcessArgs() cmdOpts = am.GetArguments() appURL = cmdOpts['applicationURL'] configFile = cmdOpts['configFile'] runConfigure = cmdOpts['runConfigure'] debugMode = cmdOpts['debug'] app = WXGUIApplication() init_args = [] if "--debug" in sys.argv or "-d" in sys.argv: init_args.append("--debug") app.Initialize("AGVCR Launcher", args=init_args) # Run the launcher agvcrlaunch = AGVCRLauncher(appURL, configFile, runConfigure, debugMode) if agvcrlaunch.runConfig: agvcrlaunch.configDialog() else: # Launcher mode if agvcrlaunch.connectToVenue(): if agvcrlaunch.generateCmdLine(): if not agvcrlaunch.launchProgram(): agvcrlaunch.displayDebug("AGVCRLauncher: Error launching program") else: agvcrlaunch.displayDebug("AGVCRLauncher: Error generating command line") else: agvcrlaunch.displayDebug("AGVCRLauncher: Error connecting to venue") agvcrlaunch.OnExit() PK t&k5bbREADME-SharedApp.txtUT  the directory is: Windows (typically): C:\Documents and Settings\\Application Data\AccessGrid\SharedApplications\AGVCR_Launcher\ Linux and Mac OS X (typically): /home//.AccessGrid/SharedApplications/AGVCR_Launcher/ ***************** The first time you run AGVCR Launcher, right-click and choose 'Configure' from its menu. You may also unpack the AGVCR Standalone environment into the shared application's directory if the system you are running AGVCR on does not have the required GTK libraries. Please see the project website for more information and updates: http://iri.informatics.indiana.edu/~dcpiper/agvcr/ NOTICE OF DISCLAIMER The faculty, staff and students, affiliates and Trustees of Indiana University, herein referred to as 'The University', do not provide warranty of this software of any kind. Users of this software, herein referred to as the User, bear sole responsibility for its use. The University cannot be held liable for unauthorized recording of conferences, meetings, videos, sounds and images or any invasions of privacy that occur from the User using this software. It is up to the User to obtain any and all permissions from meeting participants before using this software. PK t&k5v5  agvcr.batUT  "$PANGO_RC_FILE" sed "s|SUPPORTDIR|$SUPPORTTOP|g" "$SUPPORTTOP/etc/pango/pango.modules" > "$ETC/pango.modules" cp -f "$SUPPORTTOP/etc/pango/pangox.aliases" "$ETC" sed "s|SUPPORTDIR|$SUPPORTTOP|g" "$SUPPORTTOP/etc/gtk-2.0/gtk.immodules" > "$GTK_IM_MODULE_FILE" sed "s|SUPPORTDIR|$SUPPORTTOP|g" "$SUPPORTTOP/etc/gtk-2.0/gdk-pixbuf.loaders" > "$GDK_PIXBUF_MODULE_FILE" # Capture output OUTPUTCAPTURE=/tmp/agvcr_output.log echo -e "\nEnvironment:" >$OUTPUTCAPTURE export >>$OUTPUTCAPTURE echo -e "\n" >>$OUTPUTCAPTURE fi fi # Default DISPLAY to something if [ "$DISPLAY" == "" ]; then export DISPLAY=:0.0 fi if [ "$OUTPUTCAPTURE" != "" ]; then agvcr $@ 1>>$OUTPUTCAPTURE 2>>$OUTPUTCAPTURE else agvcr $@ fi if [ "$?" != "0" ]; then ARCHFULL=`uname -a` FAILURELOG=/tmp/agvcr_launch_fail.log echo -e "\n****************************************************\n" echo "Problem running AGVCR executable! Did you read the README files?" echo "Please make sure to read all README files and make sure the AGVCR" echo -e "executable is in the path of the user running this script\n" echo "If you still have problems visit the project website at:" echo -e "http://iri.informatics.indiana.edu/~dcpiper/agvcr/\n" echo -e "Please send debug information contained in $FAILURELOG\n" echo -e "****************************************************" NOWDATE=`date` echo -e "Failed AGVCR launch at $NOWDATE:\n" >$FAILURELOG echo "PATH: $PATH" >>$FAILURELOG echo "AGVCR_PATH: $AGVCR_PATH" >>$FAILURELOG echo "ARCHITECTURE: $ARCHFULL" >>$FAILURELOG if [ "$LD_LIBRARY_PATH" != "" ]; then echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" >>$FAILURELOG fi if [ "$DYLD_LIBRARY_PATH" != "" ]; then echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" >>$FAILURELOG fi echo "AGPATH: $AGPATH" >>$FAILURELOG echo -e "\nEnvironment:" >>$FAILURELOG export >>$FAILURELOG fi PK t&k5E   AGVCR_Launcher.appUT