-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
131 additions
and
1,895 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from hivemind_voice_satellite.service import VoiceClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import click | ||
from hivemind_bus_client import HiveMessageBusClient | ||
from ovos_audio.service import PlaybackService | ||
from ovos_utils import wait_for_exit_signal | ||
|
||
from hivemind_voice_satellite import VoiceClient | ||
|
||
|
||
@click.command(help="connect to HiveMind") | ||
@click.option("--host", help="hivemind host", type=str, default="wss://127.0.0.1") | ||
@click.option("--key", help="Access Key", type=str) | ||
@click.option("--password", help="Password for key derivation", type=str) | ||
@click.option("--port", help="HiveMind port number", type=int, default=5678) | ||
@click.option("--selfsigned", help="accept self signed certificates", is_flag=True) | ||
def connect(host, key, password, port, selfsigned): | ||
if not host.startswith("ws"): | ||
print("Invalid host, please specify a protocol") | ||
print(f"ws://{host} or wss://{host}") | ||
exit(1) | ||
|
||
# connect to hivemind | ||
bus = HiveMessageBusClient(key=key, | ||
password=password, | ||
port=port, | ||
host=host, | ||
useragent="VoiceSatelliteV0.3.0", | ||
self_signed=selfsigned) | ||
bus.connect() | ||
|
||
# create Audio Output interface (TTS/Music) | ||
audio = PlaybackService(bus=bus, disable_ocp=True, validate_source=False) | ||
audio.daemon = True | ||
audio.start() | ||
|
||
# STT listener thread | ||
service = VoiceClient(bus=bus) | ||
service.daemon = True | ||
service.start() | ||
|
||
wait_for_exit_signal() | ||
|
||
service.stop() | ||
audio.shutdown() | ||
|
||
|
||
if __name__ == '__main__': | ||
connect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from hivemind_bus_client.client import HiveMessageBusClient | ||
from ovos_dinkum_listener.service import OVOSDinkumVoiceService | ||
from ovos_utils.log import LOG | ||
|
||
|
||
def on_ready(): | ||
LOG.info('HiveMind Voice Satellite is ready.') | ||
|
||
|
||
def on_started(): | ||
LOG.info('HiveMind Voice Satellite started.') | ||
|
||
|
||
def on_alive(): | ||
LOG.info('HiveMind Voice Satellite alive.') | ||
|
||
|
||
def on_stopping(): | ||
LOG.info('HiveMind Voice Satellite is shutting down...') | ||
|
||
|
||
def on_error(e='Unknown'): | ||
LOG.error(f'HiveMind Voice Satellite failed to launch ({e}).') | ||
|
||
|
||
class VoiceClient(OVOSDinkumVoiceService): | ||
"""HiveMind Voice Satellite, but bus is replaced with hivemind connection""" | ||
|
||
def __init__(self, bus: HiveMessageBusClient, on_ready=on_ready, on_error=on_error, | ||
on_stopping=on_stopping, on_alive=on_alive, | ||
on_started=on_started, watchdog=lambda: None, mic=None): | ||
super().__init__(on_ready, on_error, on_stopping, on_alive, on_started, watchdog, mic) | ||
self.bus = bus | ||
|
||
def _connect_to_bus(self): | ||
pass |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.