示例#1
0
def executeDefaultConfiguration():
    NakLogger.debug("Creating default configuration...")

    config["MARVIN"] = {}
    config["MARVIN"]["name"] = "Marvin"
    # ---------------- INTERFACES -----------------
    config["INTERFACE"] = {}
    config["INTERFACE"]["names"] = "console,slack"
    config["INTERFACE"]["currentName"] = "marvin,marvin"
    # ---------------- ENGINE -----------------
    config["ENGINE"] = {}
    config["ENGINE"]["type"] = "default"
    config["ENGINE"]["name"] = "default"
    # ------------ DATABASE ACCESS ------------
    config["DAO"] = {}
    config["DAO"]["type"] = "default"
    # Standard access info non needed but for another engine in sql-like database
    config["DAO"]["address"] = "127.0.0.1"
    config["DAO"]["port"] = "0"
    config["DAO"]["database"] = "none"
    config["DAO"]["login"] = "******"
    config["DAO"]["password"] = "******"

    with open(confDir + mainConfFileName, "w") as configfile:
        config.write(configfile)
示例#2
0
文件: Engine.py 项目: Nakou/MARVIN
 def start(self,message):
     NakLogger.debug("Engine here, message from " + self.entryInterface.getInterfaceName() + " - \"" + message + "\" received!")
     wordList = Parser.parser(message)
     #Knifer
     #Meaner
     #  | - Conversation
     #  | - Context
     #AnswerMaker
     answer = "Ok"
     self.entryInterface.outCom(answer)
示例#3
0
 def __init__(self):
     NakLogger.debug("Loading InterfaceManager...")
     interfaceClassName = ""
     for item in ConfigManager.getConfig("INTERFACE","names").split(','):
         NakLogger.debug("Loading " + item + " Interface")
         interfaceClassModule = "interfaces." + item.capitalize() + "Interface"
         interfaceClassName = item.capitalize() + "Interface"
         mod = __import__(interfaceClassModule)
         submod = getattr(mod, interfaceClassName)
         klass = getattr(submod, interfaceClassName)
         self.interfaces.append(klass())
     NakLogger.debug("Loading InterfaceManager End.")
示例#4
0
文件: app.py 项目: Nakou/MARVIN
 def __init__(self):
     NakLogger.consoleDebugActive(True)
     NakLogger.debug("Starting MARVIN...")
     ConfigManager.loadConf()
     self.loadInterfaces()
示例#5
0
def loadConf():
    if os.path.isfile(confDir + mainConfFileName) == False:
        # GenerateDefaultConf
        NakLogger.warn("No confFile, generating default conf...")
        executeDefaultConfiguration()
    NakLogger.debug("Loading...")
示例#6
0
 def mainLoop(self):
     for item in self.interfaces:
         NakLogger.debug("Starting " + item.getInterfaceName())
         item.loop()