1
0

fix: 增加日志

This commit is contained in:
david-ajax
2025-12-15 15:39:05 +08:00
parent 874494874c
commit 6efd041f72
51 changed files with 635 additions and 1992 deletions

View File

@@ -1,6 +1,9 @@
from .base import BaseTTS
import pathlib
import edge_tts
from heurams.services.logger import get_logger
logger = get_logger(__name__)
class EdgeTTS(BaseTTS):
@@ -8,9 +11,16 @@ class EdgeTTS(BaseTTS):
@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
logger.debug("EdgeTTS.convert: text length=%d, path=%s", len(text), path)
try:
communicate = edge_tts.Communicate(
text,
"zh-CN-YunjianNeural",
)
logger.debug("EdgeTTS 通信对象创建成功,正在保存音频")
communicate.save_sync(str(path))
logger.debug("EdgeTTS 音频已保存到: %s", path)
return path # type: ignore
except Exception as e:
logger.error("EdgeTTS.convert 失败: %s", e)
raise