Per docs/plugin-audit-report.md (plugins normalized to Trigger(handlers) → Service(services) → Model(repository/models) + utils): - Split monolithic __init__.py into handlers/services/utils across dailywife, deer_pipe, dice, galgame_card, helldivers_tools, huoziyinshua, learning_chat, makeaquote, mc_server_status, ncm_saying, picfinder_take, picstatus, random_jm_code, regif, steam_info, video_analysis, group_tools - Move static assets under res/: deer_pipe font/img, makeaquote font, helldivers img/templates, huoziyinshua HuoZiYinShua - Add config.py + register_config_items to ncm_saying, random_jm_code, group_tools; learning_chat unified config bridge - Remove deprecated: voice_trans plugin, bf_bot/test.py, dead code in dailywife/deer_pipe, empty dirs, debug scripts under helldivers temp - Disable brash_general_supercredits_tools (stub comment only) - bot.py: optional stdout/stderr redirect to log file for Web log viewer, force ANSI colorize on non-TTY sinks - Move runtime data (jm_code.json) out of plugin dir into hexi/data - Docs: plugin-audit-report.md; README reflects removed plugins Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
924 B
Python
28 lines
924 B
Python
"""otto 活字印刷 —— 业务逻辑(Service 层)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import os
|
|
from pathlib import Path
|
|
|
|
from ..res.HuoZiYinShua.huoZiYinShua import huoZiYinShua
|
|
|
|
_PLUGIN_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
_settings = {
|
|
"sourceDirectory": str(_PLUGIN_ROOT / "res" / "HuoZiYinShua" / "sources") + os.sep,
|
|
"ysddSourceDirectory": str(_PLUGIN_ROOT / "res" / "HuoZiYinShua" / "ysddSources") + os.sep,
|
|
"dictFile": str(_PLUGIN_ROOT / "res" / "HuoZiYinShua" / "dictionary.json"),
|
|
"ysddTableFile": str(_PLUGIN_ROOT / "res" / "HuoZiYinShua" / "ysddTable.json"),
|
|
}
|
|
|
|
_HZYS = huoZiYinShua(_settings)
|
|
|
|
|
|
async def synthesize(txt: str, reverse: bool) -> bytes:
|
|
"""合成 otto 语音,返回 base64(原声大碟模式);同步调用放入线程避免阻塞事件循环。"""
|
|
return await asyncio.to_thread(
|
|
_HZYS.export, txt, True, 1, 1, False, reverse
|
|
)
|