Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A1dxvtsZx8NE9fwjXUNDBr
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Controlla che nel video «Come si gioca» il narratore non parli sopra i personaggi del gioco.
|
|
python3 video/sovrapposte.py tutorial-briscola (dopo la ripresa: cues.json, registro audio, narrazione)
|
|
"""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
VIDEO = Path(__file__).resolve().parent
|
|
clip = sys.argv[1]
|
|
cues = json.loads((Path.home() / "Workspaces/qemu/qemu-iso-lab/artifacts/tour/out" / clip / "cues.json").read_text())["cues"]
|
|
narr = {v["id"]: v["sec"] for v in json.loads((VIDEO / "out" / f"{clip}-narrazione.json").read_text())["voci"]}
|
|
voci, aperta = [], None
|
|
for e in json.loads((VIDEO / "out" / f"{clip}-audio.json").read_text())["eventi"]:
|
|
if "voice" in e:
|
|
aperta = [e["t"], None, e["voice"]]
|
|
voci.append(aperta)
|
|
elif "voiceEnd" in e and aperta:
|
|
aperta[1], aperta = e["t"], None
|
|
male = [(c["id"], v[2]) for c in cues for v in voci if v[1] and v[0] < c["start"] + narr[c["id"]] and v[1] > c["start"]]
|
|
for id_, voce in male:
|
|
print(f"✗ «{id_}» sopra {voce}")
|
|
print(f"{clip}: {len(voci)} voci del gioco, {len(cues)} frasi del narratore, {len(male)} sovrapposte")
|
|
sys.exit(1 if male else 0)
|