Open Accipiter7 opened 4 years ago
Indeed! Part of ripping out Python 2 support too..
I needed to use gtts in an async type of way so I set up a queue and a separate python script that only reads text messages from the queue and then calls gtts. That's all it does. Just loops until a message is received and then calls/plays.
I agree with this, plus it makes work better with discord bots.
+1 would be super useful in todays async/await world
Hey guys, recently for a discord bot I work on, I've forked gTTS to add experimental support for async / await. Feel free to have a look and use it if you want, just be aware that I have not tested it that extensively and I'm not going to be doing any extra work on it other than if I find a critical bug myself. Also just FYI, a significant portion of the async code was generated by AI to convert it from sync to async but it all seems to work.
https://github.com/CDE90/gTTS https://github.com/CDE90/gTTS/blob/main/gtts/tts_async.py
Ah nice! I'll check it out. Also appreciate the gen AI disclosure! 😝
I wanted to do lots of clean up to that stream function anyway.
I would love if this library had async libraries based with aiohttp. as the aiogtts package is a bit blocking because it uses b8.
Since this is network dependent library it should support async / await for non-blocking access and Hence for better concurrency. Thanks