mirror of
https://github.com/rany2/edge-tts
synced 2024-11-22 01:45:02 +00:00
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:
parent
bd9cc2bd2d
commit
d95b5d339f
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = edge-tts
|
||||
version = 6.0.9
|
||||
version = 6.1.0
|
||||
author = rany
|
||||
author_email = ranygh@riseup.net
|
||||
description = Microsoft Edge's TTS
|
||||
|
@ -14,4 +14,4 @@ __all__ = [
|
||||
"exceptions",
|
||||
"list_voices",
|
||||
]
|
||||
__version__ = "6.0.7"
|
||||
__version__ = "6.1"
|
||||
|
@ -52,12 +52,14 @@ class VoicesManager:
|
||||
self.called_create: bool = False
|
||||
|
||||
@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.
|
||||
"""
|
||||
self = VoicesManager()
|
||||
self.voices = await list_voices()
|
||||
self.voices = await list_voices() if custom_voices is None else custom_voices
|
||||
self.voices = [
|
||||
{**voice, **{"Language": voice["Locale"].split("-")[0]}}
|
||||
for voice in self.voices
|
||||
|
Loading…
Reference in New Issue
Block a user