diff --git a/data/misc/favorites.json5 b/data/misc/favorites.json5 index 3f4db12..6c52d1a 100644 --- a/data/misc/favorites.json5 +++ b/data/misc/favorites.json5 @@ -160,5 +160,11 @@ "ident": "屈平正道直行, 竭忠尽智以事其君, 谗人间之, 可谓穷矣.", "added": 1777847825, "tags": [] + }, + { + "repo_path": "cngk-t", + "ident": "上称帝喾, 下道齐桓, 中述汤武, 以刺世事.", + "added": 1777874192, + "tags": [] } ] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b2b1f67..4caf643 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,7 @@ tts-edgetts = [ "edge-tts>=7.2.8", # 微软 TTS ] llm = ["openai>=2.32.0"] -audio-playsound = [ - "playsound3==3.3.1", - #"pygobject>=3.56.2", # playsound 依赖它 -] +audio-playsound = ["playsound3>=3.3.1"] dev = [ # 调试所需依赖 "zmq>=0.0.0", # 用于 ZMQ 远程调试服务器, 在 linux 上建议先安装 libzmq "pytest>=8.0.0", # 用于普通测试 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 38e0d15..0000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -edge-tts==7.0.2 -openai==1.0.0 -playsound==1.2.2 -tabulate>=0.9.0 -textual==7.0.0 -toml==0.10.2 -transitions==0.9.3 diff --git a/src/heurams/interface/screens/memoqueue.py b/src/heurams/interface/screens/memoqueue.py index c8fd983..9ad35ea 100644 --- a/src/heurams/interface/screens/memoqueue.py +++ b/src/heurams/interface/screens/memoqueue.py @@ -156,11 +156,11 @@ class MemScreen(Screen): path = Path(config_var.get()["global"]["paths"]["data"]) / "cache" / "voice" path = path / f"{get_md5(self.atom.registry['nucleon']["tts_text"])}.wav" + logger.debug(str(path)) if path.exists(): play_by_path(path) else: from heurams.services.tts_service import convertor - convertor(self.atom.registry["nucleon"]["tts_text"], path) play_by_path(path) diff --git a/src/heurams/providers/audio/playsound_audio.py b/src/heurams/providers/audio/playsound_audio.py index db0a360..443c7c5 100644 --- a/src/heurams/providers/audio/playsound_audio.py +++ b/src/heurams/providers/audio/playsound_audio.py @@ -1,22 +1,20 @@ """通用音频适配器 -基于 playsound 库的音频播放器, 在绝大多数 python 环境上提供音频服务 -注意: 在未配置 pulseaudio 的 termux 不可用 +基于 playsound3 的音频播放器, 在绝大多数 python 环境上提供音频服务 +注意: 在 termux 不可用 """ import pathlib -import playsound +import playsound3 from heurams.services.logger import get_logger logger = get_logger(__name__) - def play_by_path(path: pathlib.Path): logger.debug("playsound_audio.play_by_path: 开始播放 %s", path) try: - playsound.playsound(str(path)) + playsound3.playsound(str(path)) logger.debug("播放完成: %s", path) except Exception as e: logger.error("播放失败: %s, 错误: %s", path, e) - raise diff --git a/uv.lock b/uv.lock index 3c5ba2d..54da3d7 100644 --- a/uv.lock +++ b/uv.lock @@ -493,7 +493,7 @@ requires-dist = [ { name = "heurams", extras = ["tts-edgetts"], marker = "extra == 'all'" }, { name = "heurams", extras = ["tts-edgetts"], marker = "extra == 'basic'" }, { name = "openai", marker = "extra == 'llm'", specifier = ">=2.32.0" }, - { name = "playsound3", marker = "extra == 'audio-playsound'", specifier = "==3.3.1" }, + { name = "playsound3", marker = "extra == 'audio-playsound'", specifier = ">=3.3.1" }, { name = "psutil", marker = "extra == 'interface'", specifier = ">=7.2.2" }, { name = "pytest", marker = "extra == 'dev'", specifier = ">=8.0.0" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=6.0.0" },