import json, re
def r1(x): return round(x*10)/10
sc = json.load(open("小说2/凡骨问长生-outline/凡骨问长生-script.json",encoding="utf-8"))
ep6 = next(e for e in sc["episodes"] if e["ep"]==6)
for scx in ep6["scenes"]:
    idx = ep6["scenes"].index(scx)+1
    if idx==2:
        print("SCRIPT E06 scene2 sceneId=", scx.get("sceneId"), "lighting=", scx.get("lighting"))
        for j,b in enumerate(scx.get("flow",[]),1):
            if 25 <= j <= 30:
                isline = isinstance(b.get("line"), str)
                secs = r1((len(re.sub(r"\s+","",b.get("line") or "")) / 4.5) if isline else 2.5)
                print("   s2 b%d %s secs=%.2f text=%s" % (j, "line" if isline else "act", secs, (b.get("line") or b.get("action"))[:20]))
# seed
seed = json.load(open("小说2/storyboard-work/ep-06-seed.json",encoding="utf-8"))
for scx in seed["seedScenes"]:
    if scx["sceneIndex"]==2:
        print("SEED E06 scene2 sceneId=", scx.get("sceneId"), "lighting=", scx.get("lighting"))
        for b in scx["beats"]:
            if 25 <= b["n"] <= 30:
                print("   b%d kind=%s secs=%r %s" % (b["n"], b.get("kind"), b.get("seconds"), b.get("text")[:20]))
