Skip to content

Commit

Permalink
feat/ggwave (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Sep 15, 2023
1 parent 2d5f46d commit f1a3b93
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
35 changes: 33 additions & 2 deletions hivemind_voice_satellite/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from ovos_utils import wait_for_exit_signal
from ovos_utils.log import init_service_logger, LOG
from hivemind_voice_satellite import VoiceClient
from threading import Event
from hivemind_bus_client.identity import NodeIdentity
from hivemind_ggwave import GGWaveSlave


@click.command(help="connect to HiveMind")
Expand All @@ -24,13 +26,42 @@ def connect(host, key, password, port, selfsigned, siteid):
siteid = siteid or identity.site_id or "unknown"
host = host or identity.default_master

if not host.startswith("ws://") and not host.startswith("wss://"):
host = "ws://" + host
if not password:
LOG.info("starting hivemind-ggwave, waiting for audio password")
try:

ggwave = GGWaveSlave(key=key) # reuse existing key

ready = Event()

def handle_complete(message):
nonlocal identity, password, key, host, ready
identity.reload()
password = identity.password
host = identity.default_master
key = identity.access_key
LOG.info(f"will connect to: {host}")
ready.set()


ggwave.bus.on("hm.ggwave.identity_updated",
handle_complete)
ggwave.start()

ready.wait()

ggwave.stop()

except Exception as e:
LOG.exception("hivemind-ggwave failed to start")

if not key or not password or not host:
raise RuntimeError("NodeIdentity not set, please pass key/password/host or "
"call 'hivemind-client set-identity'")

if not host.startswith("ws://") and not host.startswith("wss://"):
host = "ws://" + host

if not host.startswith("ws"):
LOG.error("Invalid host, please specify a protocol")
LOG.error(f"ws://{host} or wss://{host}")
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ ovos-dinkum-listener>=0.0.2, < 0.1.0
ovos-vad-plugin-webrtcvad
ovos-stt-plugin-server
ovos-tts-plugin-server
click
click
hivemind-ggwave

0 comments on commit f1a3b93

Please sign in to comment.