easygTTS-1.0
توضیحات
Easy async interface to easy-gtts-api
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | easygTTS-1.0 |
| نام | easygTTS |
| نسخه کتابخانه | 1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Gnome-py |
| ایمیل نویسنده | gnome6669.py@gmail.com |
| آدرس صفحه اصلی | https://github.com/gnome-py/py-easygTTS |
| آدرس اینترنتی | https://pypi.org/project/easygTTS/ |
| مجوز | MIT |
# py-easygTTS
Asynchronous interface to an [easy-gtts](https://github.com/Gnome-py/easy-gtts-api) server written with aiohttp.
One class currently exists, easygTTS.gtts, which takes 2 optional args `base_url` (url to a easy-gtts server) and session (aiohttp.ClientSession)
## Examples
### One time use
```python
import easygTTS
import asyncio
async def main():
async with easygTTS.gtts() as gtts:
hello_uk = await gtts.get(text="Hello World", lang="en-uk")
hello_usa = await gtts.get(text="Hello World", lang="en-us")
langs = await gtts.langs()
with open("Hello World (UK).mp3", "wb") as f:
f.write(hello_uk)
with open("Hello World (USA).mp3", "wb") as f:
f.write(hello_usa)
print(f"Returned langs = {langs}")
asyncio.run(main())
```
### Using a global session
```python
import easygTTS
import asyncio
import aiohttp
async def main():
session = aiohttp.ClientSession()
gtts = easygTTS.gtts(session=session)
hello = await gtts.get(text="Hello World")
with open("Hello.mp3", "wb") as f:
f.write(hello)
# later in your code
extra = await gtts.get(text="even more to TTS")
with open("Extra.mp3", "wb") as f:
f.write(extra)
# at the end
await session.close()
asyncio.run(main())
```
نیازمندی
| مقدار | نام |
|---|---|
| - | aiohttp |
نحوه نصب
نصب پکیج whl easygTTS-1.0:
pip install easygTTS-1.0.whl
نصب پکیج tar.gz easygTTS-1.0:
pip install easygTTS-1.0.tar.gz