Fix validation regex for voice

This fails for "fil-PH-AngeloNeural," make it more future proof
by accepting 2 or more of the same group.

Signed-off-by: rany2 <rany2@riseup.net>
This commit is contained in:
rany2
2023-06-22 18:10:17 +03:00
parent 6a3065b730
commit a1bacbe1fb
2 changed files with 3 additions and 2 deletions

View File

@@ -248,11 +248,12 @@ class Communicate:
# Possible values for voice are:
# - Microsoft Server Speech Text to Speech Voice (cy-GB, NiaNeural)
# - cy-GB-NiaNeural
# - fil-PH-AngeloNeural
# Always send the first variant as that is what Microsoft Edge does.
if not isinstance(voice, str):
raise TypeError("voice must be str")
self.voice: str = voice
match = re.match(r"^([a-z]{2})-([A-Z]{2})-(.+Neural)$", voice)
match = re.match(r"^([a-z]{2,})-([A-Z]{2,})-(.+Neural)$", voice)
if match is not None:
lang = match.group(1)
region = match.group(2)

View File

@@ -1,4 +1,4 @@
"""Edge TTS version information."""
__version__ = "6.1.6"
__version__ = "6.1.7"
__version_info__ = tuple(int(num) for num in __version__.split("."))