124 lines
4.3 KiB
Python
124 lines
4.3 KiB
Python
"Readable complete Chinese definitions and fixed source index from delivered data."
|
||
|
||
from __future__ import annotations
|
||
|
||
import hashlib
|
||
import json
|
||
from pathlib import Path
|
||
|
||
OUT = Path(__file__).resolve().parent
|
||
|
||
|
||
def main():
|
||
lines = [
|
||
"# 多视频分屏固定参考中文说明",
|
||
"",
|
||
(
|
||
"新增99保存位置(92标量含4null+7完整历史对象)/0注释;旧25图721"
|
||
"+16逐对象不变。26图820+16仅参考展示,155完整定稿0、实跑0、新增转"
|
||
"换0。"
|
||
),
|
||
"",
|
||
(
|
||
"复用SQLite→GET→既有抽屉,仅新增受信说明块与摘要;来源local_fi"
|
||
"le以docs/hel-892/multivideo-document-evid"
|
||
"ence为基准。"
|
||
),
|
||
"",
|
||
(
|
||
"上批计数勘误:watermark source-check.json实际12 G"
|
||
"it+6 Registry发布包文本,版本元数据JSON单列;复用前端为7个唯一"
|
||
"raw。旧日志与旧实际说明块保留。"
|
||
),
|
||
"",
|
||
]
|
||
index = []
|
||
for i in range(1):
|
||
b = json.loads((OUT / f"definition-{i}.json").read_bytes())
|
||
lines += [
|
||
"## " + Path(b["source_path"]).stem,
|
||
"",
|
||
b["user_overview"],
|
||
"",
|
||
b["notice"],
|
||
"",
|
||
"源路径:`" + b["source_path"] + "`",
|
||
"",
|
||
"SHA1:" + b["source_sha1"],
|
||
"",
|
||
"原字节SHA256:" + b["source_sha256"],
|
||
"",
|
||
"规范全图SHA256:" + b["canonical_sha256"],
|
||
"",
|
||
*[v + "\n" for v in b["versions"]],
|
||
"### 具体连线与处理条件",
|
||
"",
|
||
*[v + "\n" for v in b["flow"]],
|
||
"### 使用与核对",
|
||
"",
|
||
*[v + "\n" for v in b["steps"]],
|
||
"### 逐保存位置说明",
|
||
"",
|
||
]
|
||
for j, f in enumerate(b["fields"], 1):
|
||
lines += [
|
||
f"#### {j}. 节点{f['node_id']} · {f['label']}({f['field']})",
|
||
"",
|
||
f["effect"],
|
||
"",
|
||
"```json",
|
||
json.dumps(f["value"], ensure_ascii=False, indent=2),
|
||
"```",
|
||
"",
|
||
f"类:{f['class_type']};JSON类型:{f['json_type']};角色:{f['role']}。",
|
||
"",
|
||
"源位置:`" + f["pointer"] + "`",
|
||
"",
|
||
"定义默认:" + f["schema_default"] + ";单位:" + f["unit"],
|
||
"",
|
||
"范围/条件:" + f["limits"],
|
||
"",
|
||
f["execution_note"],
|
||
"",
|
||
"依据:",
|
||
]
|
||
for k in f["evidence"]:
|
||
e = b["sources"][k]
|
||
lines += [
|
||
f"- [{k}] {e['claim']};{e['file']} {e['lines'][0]}~{e['lines'][1]}行;"
|
||
f"commit {e['commit']};SHA256 {e['sha256']};{e['url']}"
|
||
]
|
||
lines += [""]
|
||
lines += ["### 零保存节点与源注释", ""]
|
||
for z in b["zero_saved_nodes"]:
|
||
lines += [z["node_id"] + " " + z["class_type"] + ":" + z["effect"], ""]
|
||
for n in b["comments"]:
|
||
lines += [
|
||
"节点" + n["node_id"] + ",位置`" + n["pointer"] + "`",
|
||
"",
|
||
n["meaning"],
|
||
"",
|
||
"```text",
|
||
n["text"],
|
||
"```",
|
||
"",
|
||
]
|
||
lines += ["### 固定原件索引", ""]
|
||
for k, e in enumerate(b["sources"]):
|
||
data = (OUT / e["local_file"]).read_bytes()
|
||
assert hashlib.sha256(data).hexdigest() == e["sha256"]
|
||
lines += [
|
||
f"{k}. {e['claim']};{e['file']} 第{e['lines'][0]}~{e['lines'][1]}行;"
|
||
f"提交{e['commit']};SHA256 {e['sha256']};{e['url']}",
|
||
"",
|
||
]
|
||
index.append(dict(document=b["source_path"], **e))
|
||
(OUT.parent / "多视频分屏固定参考中文说明.md").write_text("\n".join(lines).rstrip() + "\n")
|
||
(OUT / "fixed-source-index.json").write_text(
|
||
json.dumps(index, ensure_ascii=False, indent=2) + "\n"
|
||
)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|