This commit is contained in:
rany 2021-06-06 00:49:14 +03:00
parent 722f11081f
commit 5dea65e535
9 changed files with 50 additions and 56 deletions

18
.gitignore vendored
View File

@ -1,12 +1,14 @@
**
!edge-playback.sh
!edge-tts.py
!example
!example/**
!LICENSE
!README.md
!setup.py
# Directories
!bin
!bin/**
!examples
!examples/**
!src
!src/edgeTTS
!src/edgeTTS/**
!requirements.txt
# Files
!LICENSE
!README.md
!setup.cfg
!setup.py

View File

@ -1 +0,0 @@
src/edgeTTS/__init__.py

View File

@ -1,2 +0,0 @@
requests
websockets

32
setup.cfg Normal file
View File

@ -0,0 +1,32 @@
[metadata]
name = edge-tts
version = 0.0.4
author = rany
author_email = ranygh@riseup.net
description = Microsoft Edge's TTS
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/rany2/edge-tts
project_urls =
Bug Tracker=https://github.com/rany2/edge-tts/issues
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Operating System :: OS Independent
[options]
package_dir=
= src
packages = find:
scripts = bin/edge-playback
python_requires = >=3.6
install_requires =
requests
websockets>=9.1
[options.packages.find]
where=src
[options.entry_points]
console_scripts =
edge-tts = edgeTTS.__init__:main

View File

@ -1,42 +1,2 @@
import os
import shutil
import setuptools
# make edge-tts script
scripts=['build/edge-tts']
if not os.path.exists('build'):
os.makedirs('build')
shutil.copyfile('src/edgeTTS/__init__.py', 'build/edge-tts')
if os.name == 'posix':
shutil.copyfile('edge-playback.sh', 'build/edge-playback')
scripts+=['build/edge-playback']
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
setuptools.setup(
name="edge-tts",
version="0.0.3",
author="rany",
author_email="ranygh@riseup.net",
description="Microsoft Edge's TTS",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/rany2/edge-tts",
project_urls={
"Bug Tracker": "https://github.com/rany2/edge-tts/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
],
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
scripts=scripts,
python_requires=">=3.6",
install_requires=required,
)
setuptools.setup()

View File

@ -92,7 +92,7 @@ def _minimize(the_string, delim, max_size):
else:
return [the_string]
async def main():
async def _main():
parser = argparse.ArgumentParser(description="Microsoft Edge's Online TTS Reader")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-t', '--text', help='what TTS will say')
@ -147,8 +147,11 @@ async def main():
print("%s: %s" % ("Name" if key == "ShortName" else key, voice[key]))
seperator = True
if __name__ == "__main__":
def terminator(signo, stack_frame): sys.exit()
def terminator(signo, stack_frame): sys.exit()
def main():
signal.signal(signal.SIGINT, terminator)
signal.signal(signal.SIGTERM, terminator)
asyncio.get_event_loop().run_until_complete(main())
asyncio.get_event_loop().run_until_complete(_main())
if __name__ == "__main__":
main()

Binary file not shown.