1
0

fix: 完善

This commit is contained in:
2025-12-10 13:13:37 +08:00
parent f8e414184e
commit bd7a28718f
12 changed files with 62 additions and 40 deletions

View File

@@ -1,10 +1,13 @@
# 音频播放器, 必须基于文件操作
from .termux_audio import player as termux_player
from . import termux_audio
from . import playsound_audio
__all__ = [
"termux_player"
"termux_audio",
"playsound_audio",
]
players = {
"termux": termux_player
providers = {
"termux": termux_audio,
"playsound": playsound_audio
}

View File

@@ -2,3 +2,10 @@
基于 playsound 库的音频播放器, 在绝大多数 python 环境上提供音频服务
注意: 在未配置 pulseaudio termux 不可用
"""
import os
import pathlib
import playsound
def play_by_path(path: pathlib.Path):
playsound.playsound(str(path))

View File

@@ -0,0 +1,5 @@
from typing import Protocol
import pathlib
class PlayFunctionProtocol(Protocol):
def __call__(self, path: pathlib.Path) -> None: ...

View File

@@ -5,6 +5,7 @@
import os
import pathlib
#from .protocol import PlayFunctionProtocol
def player(path: pathlib.Path):
def play_by_path(path: pathlib.Path):
os.system(f"play-audio {path}")

View File

@@ -6,7 +6,7 @@ __all__ = [
"EdgeTTS",
]
TTSs = {
"BaseTTS": BaseTTS,
"EdgeTTS": EdgeTTS,
providers = {
"basetts": BaseTTS,
"edgetts": EdgeTTS,
}