def main(): userInput = input('[c] Create new config [l] load config: ') if userInput[::1] == 'c': configHandler.configHandler().createConfig() else: fileName = input('Enter configuration file name: ') configuration = configHandler.configHandler().loadConfig(fileName) priorityHandler.priorityHandler(configuration)
def __init__(self, appServer): self.appServer = appServer self.appHandler = appHandler(appServer) myConfigHand = configHandler(appServer) self.version = myConfigHand.getVersion() self.collectors = [] self.customers = []
def reloadConfig(): global conf conf = configHandler.configHandler(configFile=configFile) reconnectOSC() reconnectHTTP() print(str(datetime.now()) + " Configuration updated") #ugly, make a nicer result at some point? print conf
def printPriorities(self): print('') print('The following priorities have been calculated:') print('') moduleId = 0 for module in self.modules: name = self.getModuleNameById(moduleId)['name'] print(name) print('='*len(name)) self.cursor.execute('''SELECT * FROM sessions WHERE module=? AND priority>0 ORDER BY priority''', [moduleId]) priorities = self.cursor.fetchall() for priority in priorities: session = self.getSessionById(moduleId, priority[0]) print(str(priority[7]) + ': ' + configHandler.configHandler().printSingleSession(session)) moduleId += 1
def generateSchedule(self, combination): i = 0 for session in combination: sessionData = self.getSessionById(i, session[0]) weekday = sessionData['weekday'] hourStart = sessionData['hour'] minuteStart = sessionData['minute'] end = configHandler.configHandler().getEndTime( {'hour': hourStart, 'minute': minuteStart, 'duration': sessionData['duration']}) hourEnd = end['hour'] minuteEnd = end['minute'] userPriority = sessionData['userPriority'] # add session to temporary schedule self.cursor.execute('''INSERT INTO schedule (weekday, hourStart, hourEnd, minuteStart, minuteEnd, userPriority) VALUES(?, ?, ?, ?, ?, ?)''', [weekday, hourStart, hourEnd, minuteStart, minuteEnd, userPriority]) i += 1
# # This is implemented on a global level now with the globalThrottleOverride 0..1 in the json-config # # # #endregion #region GLOBALS #can be set to anything you want configFile = 'oscconfig.json' # constant for doing calculations for scaling values # keep note this is 7-bit midi only, no support for nrpn midi yet midiMaxValue = 127.0 conf = configHandler.configHandler(configFile=configFile) osc = OSC.OSCClient() http = httpHandler.httpHandler() #endregion # MidiEventList = dict() # for midiType in conf.definedMidi: # MidiEventList[midiType] = dict() # for midiNum in conf.definedMidi[midiType]: # MidiEventList[midiType][midiNum] = MidiEvent(midiNum,midiType) #generic MidiEvent-getter, can replace getAttribute/Type/Command etc #returns a configHandler.MidiEvent
def getConfigure(fileName): if '.xml' not in fileName: fileName+='.xml' fileName='../ConfigFiles/'+fileName logging.debug("Get config %s", fileName) config=XMLHelper.unpickleFile(fileName) #check to see if it is all option if config['testSuites'].lower()=="all": testTask=config['testTask'] if testTask=="multiCollectors": testTask="eventParsing" xmlFileList=os.listdir('../DataFiles/'+testTask+'/') for file in xmlFileList: if 'Test' not in file: xmlFileList.remove(file) if 'excludeSuites' in config and config['excludeSuites'].lower()!="none": exMods=config['excludeSuites'].split(",") for ex in exMods: xmlFileList.remove(ex+'.xml') else: xmlFileList=config['testSuites'].split(",") config['testSuiteFiles']=xmlFileList #adding localhost config['localhost']=socket.gethostbyname(socket.gethostname()) #adding run time now=datetime.datetime.now() myTime=str(now).replace(" ", "-") myTime=myTime.replace(":", "") testRunTime=myTime.split(".") config['runTime']=testRunTime[0] #adding customers info if it has include range, only for eventParsing and incident myCust=custHandler(config['appServer']) if config['testTask'] in ['eventParsing', 'incident']: customers=myCust.getCustomer() if len(customers)>0: config['customers']=customers #adding build version myVer=configHandler(config['appServer']) version=myVer.getVersion() if version!="": config['buildVersion']=version #if CheckSendBug option set, but no bugZillia user/password supplied, turns the option off if 'bugZillaId' not in config and 'bugZillaPass' not in config: if config['option']=='SendCheckBug': config['option']='SendCheck' #prepare test result folder directory="../Results/"+config['testTask'] if not os.path.exists(directory): os.mkdir(directory) testSever="" if config['dataCollector']==config['appServer']: testServer=config['dataCollector'] else: if ':' in config['appServer']: appServer=config['appServer'].split(':')[0] else: appServer=config['appServer'] testServer=config['dataCollector']+"("+appServer+")" if 'version' in config: folderVersion=config['version'] else: folderVersion=config['buildVersion'] testFolder=directory+"/"+config['runTime']+"-"+testServer+"-"+folderVersion config['testFolder']=testFolder logging.debug('config param: %s', config) return config
def main(): cfg = configHandler.configHandler(CONFIG_REQUIREMENTS, CFGFILE) cfg.setUserConfigs() # Run the function of the given mode AVAILABLE_MODES[cfg.mode](filepath=cfg.filepath, apikey=cfg.apikey)