Allow custom voice list to be passed to VoiceManager
* Useful so that the application could cache the list. * Bump to version 6.1.x
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = edge-tts
|
name = edge-tts
|
||||||
version = 6.0.9
|
version = 6.1.0
|
||||||
author = rany
|
author = rany
|
||||||
author_email = ranygh@riseup.net
|
author_email = ranygh@riseup.net
|
||||||
description = Microsoft Edge's TTS
|
description = Microsoft Edge's TTS
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ __all__ = [
|
|||||||
"exceptions",
|
"exceptions",
|
||||||
"list_voices",
|
"list_voices",
|
||||||
]
|
]
|
||||||
__version__ = "6.0.7"
|
__version__ = "6.1"
|
||||||
|
|||||||
@@ -52,12 +52,14 @@ class VoicesManager:
|
|||||||
self.called_create: bool = False
|
self.called_create: bool = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create(cls: Any) -> "VoicesManager":
|
async def create(
|
||||||
|
cls: Any, custom_voices: Optional[List[Dict[str, Any]]] = None
|
||||||
|
) -> Any:
|
||||||
"""
|
"""
|
||||||
Creates a VoicesManager object and populates it with all available voices.
|
Creates a VoicesManager object and populates it with all available voices.
|
||||||
"""
|
"""
|
||||||
self = VoicesManager()
|
self = VoicesManager()
|
||||||
self.voices = await list_voices()
|
self.voices = await list_voices() if custom_voices is None else custom_voices
|
||||||
self.voices = [
|
self.voices = [
|
||||||
{**voice, **{"Language": voice["Locale"].split("-")[0]}}
|
{**voice, **{"Language": voice["Locale"].split("-")[0]}}
|
||||||
for voice in self.voices
|
for voice in self.voices
|
||||||
|
|||||||
Reference in New Issue
Block a user