Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/ggwave #37

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading