1
0

更新 providers

This commit is contained in:
2025-11-02 03:15:18 +08:00
parent eb10833643
commit ee901e8be5
20 changed files with 160 additions and 249 deletions

View File

@@ -0,0 +1,12 @@
from .base import BaseTTS
from .edge_tts import EdgeTTS
__all__ = [
"BaseTTS",
"EdgeTTS",
]
TTSs = {
"BaseTTS": BaseTTS,
"EdgeTTS": EdgeTTS,
}

View File

@@ -0,0 +1,9 @@
import pathlib
class BaseTTS:
name = "BaseTTS"
@classmethod
def convert(cls, text: str, path: pathlib.Path | str = "") -> pathlib.Path:
"""path 是可选参数, 不填则自动返回生成文件路径"""
return path # type: ignore

View File

@@ -0,0 +1,15 @@
from .base import BaseTTS
import pathlib
import edge_tts
class EdgeTTS(BaseTTS):
name = "EdgeTTS"
@classmethod
def convert(cls, text, path: pathlib.Path | str = "") -> pathlib.Path:
communicate = edge_tts.Communicate(
text,
"zh-CN-YunjianNeural",
)
communicate.save_sync(str(path))
return path # type: ignore