From e09746b00286df7c107e3dd0386e26f208ae59ef Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Wed, 22 Feb 2017 09:35:07 +0100 Subject: [PATCH] Fix say cutting tts Without flushing song was played before being totally written to file --- stormbot/say.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stormbot/say.py b/stormbot/say.py index 02c7b22..62117a9 100644 --- a/stormbot/say.py +++ b/stormbot/say.py @@ -24,5 +24,6 @@ def run(self, bot, msg, parser, args): tts = gTTS(text=args.text, lang=args.lang) with NamedTemporaryFile() as f: tts.write_to_fp(f) + f.flush() cmd = ['play', '-t', 'mp3', f.name] - subprocess.check_call(cmd) + subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)