数字我 Digital Me:全量入库(大文件走 Git LFS)
nginx serve /uploads direct (audio speed) / patch-nginx (push) Failing after 1m34s
nginx serve /uploads direct (audio speed) / patch-nginx (push) Failing after 1m34s
This commit is contained in:
Executable
+86
@@ -0,0 +1,86 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from docx import Document
|
||||
from docx.oxml.ns import qn
|
||||
|
||||
|
||||
path = Path(r"D:\workspace\digital_me\artifacts\《我为你研墨》完整歌词脚本与20镜分镜提示词(每镜10秒).docx")
|
||||
issues = []
|
||||
with zipfile.ZipFile(path) as zf:
|
||||
bad = zf.testzip()
|
||||
media = [n for n in zf.namelist() if n.startswith("word/media/")]
|
||||
if bad:
|
||||
issues.append(f"Corrupt member: {bad}")
|
||||
if media:
|
||||
issues.append(f"Unexpected embedded images: {media}")
|
||||
|
||||
doc = Document(path)
|
||||
text = "\n".join(p.text for p in doc.paragraphs)
|
||||
for table in doc.tables:
|
||||
for row in table.rows:
|
||||
text += "\n" + "\t".join(cell.text for cell in row.cells)
|
||||
|
||||
scene_headings = [p.text for p in doc.paragraphs if p.style.name == "Heading 1" and p.text.startswith("分镜 ")]
|
||||
if len(scene_headings) != 20:
|
||||
issues.append(f"Expected 20 shot headings, found {len(scene_headings)}")
|
||||
if text.count("10秒分镜提示词(可直接复制)") != 20:
|
||||
issues.append("Expected 20 prompt sections")
|
||||
if text.count("生成时长严格10秒") != 20:
|
||||
issues.append("Every prompt is not explicitly fixed to 10 seconds")
|
||||
|
||||
lyrics = [
|
||||
"你杀了我祖父的那一年", "我还不会写字", "如今我替你 把诏书写得漂亮",
|
||||
"一笔一划 都是你要的锋芒", "掖庭里长大 罪臣的孙女", "我把恨 磨成了墨",
|
||||
"一滴 不许它响", "该恨你 还是该谢你", "你毁了我的家 又给了我笔",
|
||||
"我为你研墨 也为自己活", "仇人的江山 我替她说", "你看不透我 我也看不透我",
|
||||
"这盘棋里 谁是谁的 因果", "掌上起风 婉儿落笔", "你不问我恨不恨 你只看我写得好不好",
|
||||
"我也学会了 把心 藏进批注的小字号", "你老了 手也抖了 我扶你上朝",
|
||||
"这一路 我们谁也没提过 那道诏", "祖父啊 我没替你报仇",
|
||||
"我活成了 比报仇 更长的一句咒", "或者 只是一个 想活下去的人",
|
||||
"墨干了 诏成了", "风 还在掌上",
|
||||
]
|
||||
missing = [line for line in lyrics if line not in text]
|
||||
if missing:
|
||||
issues.append(f"Missing lyric lines: {missing}")
|
||||
|
||||
for marker in ("TODO", "TBD", "【统一风格前缀】", "placeholder"):
|
||||
if marker in text:
|
||||
issues.append(f"Unexpected placeholder: {marker}")
|
||||
|
||||
tables = []
|
||||
for index, table in enumerate(doc.tables, start=1):
|
||||
tblpr = table._tbl.tblPr
|
||||
tblw = tblpr.find(qn("w:tblW"))
|
||||
grid = [int(x.get(qn("w:w"))) for x in table._tbl.tblGrid.findall(qn("w:gridCol"))]
|
||||
expected = sum(grid)
|
||||
if tblw is None or int(tblw.get(qn("w:w"))) != expected or expected != 9360:
|
||||
issues.append(f"Table {index}: invalid total geometry")
|
||||
for row in table.rows:
|
||||
widths = []
|
||||
for cell in row.cells:
|
||||
tcw = cell._tc.get_or_add_tcPr().find(qn("w:tcW"))
|
||||
widths.append(int(tcw.get(qn("w:w"))) if tcw is not None else None)
|
||||
if widths != grid:
|
||||
issues.append(f"Table {index}: cell/grid mismatch")
|
||||
break
|
||||
tables.append({"table": index, "rows": len(table.rows), "cols": len(table.columns), "width_dxa": expected})
|
||||
|
||||
result = {
|
||||
"file": str(path),
|
||||
"bytes": path.stat().st_size,
|
||||
"paragraphs": len(doc.paragraphs),
|
||||
"tables": tables,
|
||||
"shot_headings": len(scene_headings),
|
||||
"prompt_sections": text.count("10秒分镜提示词(可直接复制)"),
|
||||
"fixed_10s_prompts": text.count("生成时长严格10秒"),
|
||||
"embedded_images": 0,
|
||||
"missing_lyrics": missing,
|
||||
"issues": issues,
|
||||
"status": "PASS" if not issues else "FAIL",
|
||||
}
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
raise SystemExit(0 if not issues else 1)
|
||||
Reference in New Issue
Block a user