from threading import Thread, Lock from mycroft.messagebus.client.ws import WebsocketClient from mycroft.messagebus.message import Message from mycroft.tts import tts_factory from mycroft.util.log import getLogger from xml.dom import minidom import os from traceback import print_exc import dbus.mainloop.glib from gi.repository import GLib tts = tts_factory.create() client = None mutex = Lock() logger = getLogger("CLIClient") guioutputstring = '' def handle_speak(event): mutex.acquire() client.emit(Message("recognizer_loop:audio_output_start")) try: utterance = event.metadata.get('utterance') logger.info("Speak: " + utterance) global guioutputstring guioutputstring = utterance logger.info("guioutputstring: " + guioutputstring) dbusout()
import sys from threading import Thread, Lock import re from mycroft.client.speech.listener import RecognizerLoop from mycroft.configuration import ConfigurationManager from mycroft.messagebus.client.ws import WebsocketClient from mycroft.messagebus.message import Message from mycroft.tts import tts_factory from mycroft.util.log import getLogger from mycroft.util import kill, connected from mycroft.util import play_mp3 logger = getLogger("SpeechClient") client = None tts = tts_factory.create() mutexTalking = Lock() loop = None config = ConfigurationManager.get() def handle_record_begin(): logger.info("Begin Recording...") client.emit(Message('recognizer_loop:record_begin')) def handle_record_end(): logger.info("End Recording...") client.emit(Message('recognizer_loop:record_end'))