From 6ea93100f986bc2bc77f615069565185325bd722 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 8 Jan 2024 14:43:47 +0300 Subject: [PATCH] Fix speaking (garbage code) --- rpid/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpid/main.py b/rpid/main.py index 23511ba..a650e7e 100644 --- a/rpid/main.py +++ b/rpid/main.py @@ -39,7 +39,10 @@ async def toggle(number: int) -> str: @app.get("/speak") async def speak(text: str) -> str: - ret = os.system(f'gtts-cli "{text}" --lang tr --output text.mp3; pw-play text.mp3') + with open("speak.txt") as f: + f.write(text) + + ret = os.system(f'gtts-cli --file speak.txt --lang tr --output text.mp3; pw-play text.mp3') return f"TEXT {'OK' if ret == 0 else 'FAIL'}, TEXT: {text}";