def start_mind(config=None, bus=None, daemonic=False, streaming=True): config = config or CONFIGURATION # listen listener = get_listener(bus=bus, streaming=streaming) # read port and ssl settings listener.load_config(config) if daemonic: create_daemon(listener.listen) else: listener.listen()
def create_gui_service(enclosure, config): import tornado.options LOG.info('Starting message bus for GUI...') # Disable all tornado logging so mycroft loglevel isn't overridden tornado.options.parse_command_line(['--logging=None']) routes = [(config['route'], GUIWebsocketHandler)] application = web.Application(routes, debug=True) application.enclosure = enclosure application.listen(config['base_port'], config['host']) create_daemon(ioloop.IOLoop.instance().start) LOG.info('GUI Message bus started!') return application
def start_mind(config=None, bus=None, daemonic=False): config = config or CONFIGURATION # listen listener = get_listener(bus=bus) # use http # config["ssl"]["use_ssl"] = False # read port and ssl settings listener.load_config(config) if daemonic: create_daemon(listener.listen) else: listener.listen()
def _run_curses_gui(self, stdscr): curses.echo() lasty, lastx = stdscr.getmaxyx() self.input_box = curses.newwin(0, lastx, lasty - 3, 0) self.header_box = curses.newwin(lasty - 4, lastx, 0, 0) self.header_box.addstr( "=== {platform} ===".format(platform=self.platform)) self.msg_box = curses.newwin(lasty - 4, lastx, 1, 0) self.msg_box.scrollok(True) def refresh(): while True: self.header_box.refresh() self.msg_box.refresh() self.input_box.refresh() sleep(0.5) create_daemon(refresh) while True: self.input_box.addstr("Input > ") msg = self.input_box.getstr() if msg: utterance = str(msg.decode("utf-8")) self.msg_box.addstr("You > " + utterance + "\n") msg = { "data": { "utterances": [utterance], "lang": "en-us" }, "type": "recognizer_loop:utterance", "context": { "source": self.client.peer, "destination": "hive_mind", "platform": self.platform } } self.send_to_hivemind_bus(msg) self.waiting = True self.input_box.clear()
from ovos_utils.messagebus import send_message from ovos_utils.log import LOG from ovos_utils import create_daemon, wait_for_exit_signal import random from time import sleep def alert(): LOG.info("Alerting user of some event using Mycroft") send_message("speak", {"utterance": "Alert! something happened"}) def did_something_happen(): while True: if random.choice([True, False]): alert() sleep(10) create_daemon(did_something_happen) # check for something in background wait_for_exit_signal() # wait for ctrl+c
def sync_skills_list_threaded(self, merge=False, new_only=False): return create_daemon(self.sync_skills_list, (merge, new_only))
def onOpen(self): super().onOpen() create_daemon(self.factory.run_curses)
def start_hackchat(self): self.hackchat.on_message += [self.on_hack_message] self.hackchat.on_join += [self.on_hack_join] self.hackchat.on_open += [self.on_hack_open] self.hackchat.on_leave += [self.on_hack_leave] create_daemon(self.hackchat.run)
def onOpen(self): super().onOpen() create_daemon(self.factory.run_deltachat)
def onOpen(self): super().onOpen() create_daemon(self.factory.start_listening)
def connect_to_mmost(self): create_daemon(self._mmost_run)