Updated packages, only run `mpv` if needed

pull/266/merge
killian 6 months ago
parent 6c3bcd214b
commit 6ee37e7f66

12
software/poetry.lock generated

@ -957,13 +957,13 @@ dev = ["mypy (>=0.990)", "types-python-xlib (>=0.32)", "types-setuptools (>=65.5
[[package]] [[package]]
name = "exceptiongroup" name = "exceptiongroup"
version = "1.2.1" version = "1.2.2"
description = "Backport of PEP 654 (exception groups)" description = "Backport of PEP 654 (exception groups)"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
{file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
] ]
[package.extras] [package.extras]
@ -6929,13 +6929,13 @@ dev = ["pre-commit", "pytest", "ruff (>=0.3.0)"]
[[package]] [[package]]
name = "sentry-sdk" name = "sentry-sdk"
version = "2.9.0" version = "2.10.0"
description = "Python client for Sentry (https://sentry.io)" description = "Python client for Sentry (https://sentry.io)"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
files = [ files = [
{file = "sentry_sdk-2.9.0-py2.py3-none-any.whl", hash = "sha256:0bea5fa8b564cc0d09f2e6f55893e8f70286048b0ffb3a341d5b695d1af0e6ee"}, {file = "sentry_sdk-2.10.0-py2.py3-none-any.whl", hash = "sha256:87b3d413c87d8e7f816cc9334bff255a83d8b577db2b22042651c30c19c09190"},
{file = "sentry_sdk-2.9.0.tar.gz", hash = "sha256:4c85bad74df9767976afb3eeddc33e0e153300e887d637775a753a35ef99bee6"}, {file = "sentry_sdk-2.10.0.tar.gz", hash = "sha256:545fcc6e36c335faa6d6cda84669b6e17025f31efbf3b2211ec14efe008b75d1"},
] ]
[package.dependencies] [package.dependencies]

@ -155,6 +155,8 @@ class Device:
async def play_audiosegments(self): async def play_audiosegments(self):
"""Plays them sequentially.""" """Plays them sequentially."""
if self.tts_service == "elevenlabs":
print("Ensure `mpv` in installed to use `elevenlabs`.\n\n(On macOSX, you can run `brew install mpv`.)")
mpv_command = ["mpv", "--no-cache", "--no-terminal", "--", "fd://0"] mpv_command = ["mpv", "--no-cache", "--no-terminal", "--", "fd://0"]
mpv_process = subprocess.Popen( mpv_process = subprocess.Popen(
mpv_command, mpv_command,

@ -58,6 +58,8 @@ async def websocket_endpoint(
data = await websocket.receive() data = await websocket.receive()
await asyncio.sleep(0)
if isinstance(data, bytes): if isinstance(data, bytes):
await interpreter.input(data) await interpreter.input(data)
elif "bytes" in data: elif "bytes" in data:
@ -71,13 +73,14 @@ async def websocket_endpoint(
while True: while True:
output = await interpreter.output() output = await interpreter.output()
await asyncio.sleep(0)
if isinstance(output, bytes): if isinstance(output, bytes):
# print(f"Sending {len(output)} bytes of audio data.") print(f"Sending {len(output)} bytes of audio data.")
await websocket.send_bytes(output) await websocket.send_bytes(output)
# we dont send out bytes rn, no TTS
elif isinstance(output, dict): elif isinstance(output, dict):
# print("sending text") print("sending text")
await websocket.send_text(json.dumps(output)) await websocket.send_text(json.dumps(output))
await asyncio.gather(send_output(), receive_input()) await asyncio.gather(send_output(), receive_input())

Loading…
Cancel
Save