Esempio n. 1
0
def http_terminal():
    logger.info("正在接收http请求。\n")
    flag=True
    while flag:
        commond = get_config(keys=['commond']).get('commond')
        set_config(values={'commond':''})
        if commond:
            translator=Analysiser(commond)
            # 父进程结束时,子进程也结束。
            translator.setDaemon(True)
            translator.start()
        time.sleep(0.5)
Esempio n. 2
0
    logger.info("正在接收http请求。\n")
    flag=True
    while flag:
        commond = get_config(keys=['commond']).get('commond')
        set_config(values={'commond':''})
        if commond:
            translator=Analysiser(commond)
            # 父进程结束时,子进程也结束。
            translator.setDaemon(True)
            translator.start()
        time.sleep(0.5)
    
try:
    # 初始化播放器
    
    set_config(values={'state':'play'})
    set_config(values={'commond':''})
    speek = Speeker()
    # 语音反馈
    #speek.speek({},u"margin,晚上好。")
    # 获取百度语音的token
    baiduApi = BaiduApi()
    baiduApi.init_token()
    token = baiduApi.get_token()
    # 开始工作录音
    recorder.start(wav_queue)
    # 开始音频解析
    voice2words.start(wav_queue,token)
    # 开始接收指令
    #start_input()
    http_terminal = threading.Thread(target=http_terminal,args=())