Update to edge-tts 4.0.0

This commit is contained in:
rany
2021-12-07 22:09:43 +02:00
parent 756766fe6e
commit 4fcecddaf0
16 changed files with 207 additions and 101 deletions

View File

@@ -1,21 +1,27 @@
#!/usr/bin/env python3
# Example Python script that shows how to use edge-tts as a module
"""
Example Python script that shows how to use edge-tts as a module
"""
import asyncio
import tempfile
from playsound import playsound
import edgeTTS
import edge_tts
async def main():
communicate = edgeTTS.Communicate()
"""
Main function
"""
communicate = edge_tts.Communicate()
ask = input("What do you want TTS to say? ")
with tempfile.NamedTemporaryFile() as fp:
with tempfile.NamedTemporaryFile() as temporary_file:
async for i in communicate.run(ask):
if i[2] is not None:
fp.write(i[2])
playsound(fp.name)
temporary_file.write(i[2])
playsound(temporary_file.name)
if __name__ == "__main__":