Skip to content

Commit

Permalink
Fix validation regex for voice
Browse files Browse the repository at this point in the history
This fails for "fil-PH-AngeloNeural," make it more future proof
by accepting 2 or more of the same group.

Signed-off-by: rany2 <[email protected]>
  • Loading branch information
rany2 committed Jun 22, 2023
1 parent 6a3065b commit a1bacbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/edge_tts/communicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ def __init__(
# 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)
Expand Down
2 changes: 1 addition & 1 deletion src/edge_tts/version.py
Original file line number Diff line number Diff line change
@@ -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("."))

0 comments on commit a1bacbe

Please sign in to comment.