Slight cleanup of util code & misc changes
This commit is contained in:
@@ -7,5 +7,11 @@ from .communicate import Communicate
|
|||||||
from .list_voices import VoicesManager, list_voices
|
from .list_voices import VoicesManager, list_voices
|
||||||
from .submaker import SubMaker
|
from .submaker import SubMaker
|
||||||
|
|
||||||
__all__ = ["Communicate", "VoicesManager", "SubMaker", "exceptions", "list_voices"]
|
__all__ = [
|
||||||
|
"Communicate",
|
||||||
|
"SubMaker",
|
||||||
|
"VoicesManager",
|
||||||
|
"exceptions",
|
||||||
|
"list_voices",
|
||||||
|
]
|
||||||
__version__ = "6.0.5"
|
__version__ = "6.0.5"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Constants for the edgeTTS package.
|
Constants for the Edge TTS project.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
TRUSTED_CLIENT_TOKEN = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"
|
TRUSTED_CLIENT_TOKEN = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"
|
||||||
|
|||||||
@@ -74,27 +74,17 @@ async def _async_main() -> None:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v",
|
"-v",
|
||||||
"--voice",
|
"--voice",
|
||||||
help="voice for TTS. " "Default: en-US-AriaNeural",
|
help="voice for TTS. Default: en-US-AriaNeural",
|
||||||
default="en-US-AriaNeural",
|
default="en-US-AriaNeural",
|
||||||
)
|
)
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"-l",
|
"-l",
|
||||||
"--list-voices",
|
"--list-voices",
|
||||||
help="lists available voices",
|
help="lists available voices and exits",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument("--rate", help="set TTS rate. Default +0%%.", default="+0%")
|
||||||
"-r",
|
parser.add_argument("--volume", help="set TTS volume. Default +0%%.", default="+0%")
|
||||||
"--rate",
|
|
||||||
help="set TTS rate. Default +0%%. For more info check https://bit.ly/3eAE5Nx",
|
|
||||||
default="+0%",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"-V",
|
|
||||||
"--volume",
|
|
||||||
help="set TTS volume. Default +0%%. For more info check https://bit.ly/3eAE5Nx",
|
|
||||||
default="+0%",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-O",
|
"-O",
|
||||||
"--overlapping",
|
"--overlapping",
|
||||||
@@ -116,18 +106,16 @@ async def _async_main() -> None:
|
|||||||
await _print_voices(proxy=args.proxy)
|
await _print_voices(proxy=args.proxy)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if args.text is not None or args.file is not None:
|
if args.file is not None:
|
||||||
if args.file is not None:
|
# we need to use sys.stdin.read() because some devices
|
||||||
# we need to use sys.stdin.read() because some devices
|
# like Windows and Termux don't have a /dev/stdin.
|
||||||
# like Windows and Termux don't have a /dev/stdin.
|
if args.file == "/dev/stdin":
|
||||||
if args.file == "/dev/stdin":
|
args.text = sys.stdin.read()
|
||||||
# logger.debug("stdin detected, reading natively from stdin")
|
else:
|
||||||
args.text = sys.stdin.read()
|
with open(args.file, "r", encoding="utf-8") as file:
|
||||||
else:
|
args.text = file.read()
|
||||||
# logger.debug("reading from %s" % args.file)
|
|
||||||
with open(args.file, "r", encoding="utf-8") as file:
|
|
||||||
args.text = file.read()
|
|
||||||
|
|
||||||
|
if args.text is not None:
|
||||||
await _run_tts(args)
|
await _run_tts(args)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user