def getskills(self, intent, text, tok): s = skills() m = xlMusic() if intent == 'clock': clock.start(tok) elif intent == 'camera': camera.start(tok) elif intent == 'smarthome': smarthome.start(tok) elif intent == 'weather': weather.start(tok) elif intent == 'music': m.start(tok) elif intent == 'translate': ts.start(tok) elif intent == 'email': mail.start(tok) elif intent == 'joke': joke.start(tok) elif intent == 'news': news.start(tok) elif intent == 'express': express.start(tok) elif intent == 'reintent': nlu.do_intent(text, tok) elif intent == 'no': speaker.speacilrecorder() else: nlu.do_intent(text, tok)
def getskills(self, intent, text, tok): if intent == 'clock': clock.start(tok) elif intent == 'camera': camera.start(tok) elif intent == 'smarthome': smarthome.start(tok) elif intent == 'weather': weather.start(tok) elif intent == 'music': music.start(tok) elif intent == 'mail': mail.start(tok) elif intent == 'joke': joke.start(tok) elif intent == 'news': news.start(tok) elif intent == 'tuling': tuling.start(text, tok) elif intent == 'snowboytrain': snowboytrain.start(tok) elif intent == 'raspberrypi-gpio': raspberrypigpio.start(tok) elif intent == 'respeaker': speaker.speak() elif intent == 'no': sconvenstation() elif intent == 'reintent': intent = nlp.do_intent(text, tok) s.getskills(intent, text, tok)
def __init__(self): self.skillsdef = { 'weather': ['weather', weather.start()], 'clock': ['clock', clock.start()], 'joke': ['joke', joke.start()], 'smarthome': ['smarthome', self.sm.main()], 'news': ['news', news.start()]
class skills(Xiaolan): def __init__(self): self.skillsdef = { 'weather': weather.start(), 'clock': clock.start(), 'joke': joke.start(), 'smarthome': self.sm.main(), 'news': news.start() }
def weather(self, tok): weather.start(tok)
if __name__ == "__main__": if not os.path.exists("log"): os.makedirs("log") logging.basicConfig( filename="log\\ss.log", level=logging.DEBUG, format='%(asctime)s %(name)s.%(funcName)s %(levelname)s %(message)s') formatter = logging.Formatter( '%(asctime)s %(name)s.%(funcName)s %(levelname)s %(message)s') fileHandler = TimedRotatingFileHandler("log\\%s.log" % config.logname, when="d", interval=1, backupCount=20) fileHandler.setFormatter(formatter) log.addHandler(fileHandler) consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(formatter) log.addHandler(consoleHandler) port = 5000 if is_port_used(port): log.error("port is being used. Quit") sys.exit(0) weather.start(int(config.get("weather_update"))) app.run(host='0.0.0.0', port=port, threaded=True) # http://192.168.1.10:5000/media/2009-1/SNC13009.jpg