diff --git a/.gitignore b/.gitignore index 2447b85..af662d0 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/edge-playback.sh b/bin/edge-playback similarity index 100% rename from edge-playback.sh rename to bin/edge-playback diff --git a/edge-tts.py b/edge-tts.py deleted file mode 120000 index cea074f..0000000 --- a/edge-tts.py +++ /dev/null @@ -1 +0,0 @@ -src/edgeTTS/__init__.py \ No newline at end of file diff --git a/example/input_example.py b/examples/input_example.py similarity index 100% rename from example/input_example.py rename to examples/input_example.py diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 37fb674..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -requests -websockets diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..57119e6 --- /dev/null +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py index b73a179..a4f49f9 100644 --- a/setup.py +++ b/setup.py @@ -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() diff --git a/src/edgeTTS/__init__.py b/src/edgeTTS/__init__.py index fb5b483..dd4bbca 100755 --- a/src/edgeTTS/__init__.py +++ b/src/edgeTTS/__init__.py @@ -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() diff --git a/src/edgeTTS/__pycache__/__init__.cpython-39.pyc b/src/edgeTTS/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..ab4b9f5 Binary files /dev/null and b/src/edgeTTS/__pycache__/__init__.cpython-39.pyc differ