mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-10 17:44:48 +08:00
1.1 KiB
1.1 KiB
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 端打印的提示信息,比起 print,该信息更希望 Electron 端的关注。
usage
{
command: "usage",
content: string
}
Gummy 字幕引擎结束时打印计费消耗信息。
caption
{
command: "caption",
index: number,
time_s: string,
time_t: string,
text: string,
translation: string
}
Python 端监听到的音频流转换为的字幕数据。