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,10 @@
# 音频播放器, 必须基于文件操作
from .termux_audio import player as termux_player
__all__ = [
"termux_player"
]
players = {
"termux": termux_player
}

View File

@@ -0,0 +1,4 @@
""" 通用音频适配器
基于 playsound 库的音频播放器, 在绝大多数 python 环境上提供音频服务
注意: 在未配置 pulseaudio 的 termux 不可用
"""

View File

@@ -0,0 +1,10 @@
""" Termux 音频适配
适配 Termux 的 play-audio 命令, 以在 android 上提供可用的播放体验
无需配置 pulseaudio
"""
import os
import pathlib
def player(path: pathlib.Path):
os.system(f"play-audio {path}")

View File

@@ -0,0 +1 @@
# 大语言模型

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