Пример #1
0
def wakeup():
    while not exit_flag:
        #mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            print("Heard: %r" % stt_response)
            if (jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except NotUnderstoodException:
            commonsense.sorry()
        except Exception:
            print("Error in processing loop:")
            traceback.print_exc()
            commonsense.uhoh()
Пример #2
0
def wakeup():
    while not exit_flag:
        #mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            print("Heard: %r" % stt_response)
            if(jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except NotUnderstoodException:
            commonsense.sorry()
        except Exception:
            print("Error in processing loop:")
            traceback.print_exc()
            commonsense.uhoh()
Пример #3
0
def check_sleep(words):
    if 'sleep' in words or 'hibernate' in words:
        commonsense.sleepy()
        sleep()
    if ('shut' in words and 'down' in words) or 'bye' in words or 'goodbye' in words:
        tts_engine.say("I am shutting down")
        exit_flag = 1
        return True
Пример #4
0
def check_sleep(words):
    if 'sleep' in words or 'hibernate' in words:
        commonsense.sleepy()
        sleep()
    if ('shut' in words
            and 'down' in words) or 'bye' in words or 'goodbye' in words:
        tts_engine.say("I am shutting down")
        exit_flag = 1
        return True
Пример #5
0
def wakeup():
    while True:
        mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            if (jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except:
            commonsense.sorry()
Пример #6
0
def wakeup():
    while True:
        mic = microphone.Microphone()
        a, s_data = mic.listen()
        a = 0
        if mic.is_silent(s_data):
            commonsense.sleepy()
            sleep()
        try:
            stt_engine = google_stt.Google_STT(mic)
            stt_response = stt_engine.get_text()
            if(jarvis_brain.process(stt_response)):
                pass
            else:
                if check_sleep(stt_response.split(' ')):
                    break
                response = k.respond(stt_response)
                print(response)
                tts_engine.say(response)
        except:
            commonsense.sorry()