From a1bacbe1fb93de1233e434e33b865f2ba13150db Mon Sep 17 00:00:00 2001 From: rany2 Date: Thu, 22 Jun 2023 18:10:17 +0300 Subject: [PATCH] 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 --- src/edge_tts/communicate.py | 3 ++- src/edge_tts/version.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/edge_tts/communicate.py b/src/edge_tts/communicate.py index d04e646..bef02fa 100644 --- a/src/edge_tts/communicate.py +++ b/src/edge_tts/communicate.py @@ -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) diff --git a/src/edge_tts/version.py b/src/edge_tts/version.py index d82944d..e972997 100644 --- a/src/edge_tts/version.py +++ b/src/edge_tts/version.py @@ -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("."))