Files
auto-caption/docs/api-docs/caption-engine.md
himeditator 3792eb88b6 refactor(engine): 重构字幕引擎
- 更新 GummyTranslator 类,优化字幕生成逻辑
- 移除 audioprcs 模块,音频处理功能转移到 utils 模块
- 重构 sysaudio 模块,提高音频流管理的灵活性和稳定性
- 修改 TODO.md,完成按时间降序排列字幕记录的功能
- 更新文档,说明因资源限制将不再维护英文和日文文档
2025-07-26 23:37:24 +08:00

912 B

caption engine api-doc

本文档主要 Electron 主进程和字幕引擎进程的通信约定。

原理说明

本项目的 Python 进程通过标准输出向 Electron 主进程发送数据。

Python 进程标准输出 (sys.stdout) 的内容一定为一行一行的字符串。且每行字符串均可以解释为一个 JSON 对象。每个 JSON 对象一定有 command 参数。

输出约定

当 JSON 对象的 command 参数为下列值时,表示的对应的含义:

print

{
  command: "print",
  content: string
}

输出 Python 端打印的内容。

info

{
  command: "info",
  content: string
}

Python 端打印的提示信息。

caption

{
  command: "caption",
  index: number,
  time_s: string,
  time_t: string,
  end: boolean,
  text: string,
  translation: string
}

Python 端监听到的音频流转换为的字幕数据。