Skip to content

Commit

Permalink
Fix say cutting tts
Browse files Browse the repository at this point in the history
Without flushing song was played before being totally written to file
  • Loading branch information
Paul Fariello committed Feb 22, 2017
1 parent 7d55af4 commit e09746b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stormbot/say.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit e09746b

Please sign in to comment.