File size: 1,430 Bytes
4af42ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import hashlib, json, os, sys
root = sys.argv[1]
m = json.load(open(os.path.join(root, "sha256.json")))
bad = []
for rel, h in m.items():
    p = os.path.join(root, rel)
    if not os.path.isfile(p): bad.append((rel, "missing")); continue
    if hashlib.sha256(open(p, "rb").read()).hexdigest() != h: bad.append((rel, "mismatch"))
allf = {os.path.relpath(os.path.join(d, f), root) for d, _, fs in os.walk(root) for f in fs}
print("listed:", len(m), "bad:", len(bad), "unlisted files:", sorted(allf - set(m)))
for b in bad[:20]: print(b)

ids = [l.strip() for l in open(os.path.join(root, "priority_200.ids.txt")) if l.strip()]
print("ids:", len(ids), "unique:", len(set(ids)))
from collections import Counter
cnt = Counter(); total = 0; pbad = []
for pr, eid in enumerate(ids, 1):
    ed = os.path.join(root, "episodes", eid)
    sm = json.load(open(os.path.join(ed, "shot_mapping.json")))
    ss = json.load(open(os.path.join(ed, "story_script.json")))
    shots = sm["shots"]; cnt[len(shots)] += 1
    for s in shots:
        scenes = [sc for sc in ss["scenes"] if sc["scene_num"] == s["storymem_scene_num"]]
        assert len(scenes) == 1, (eid, s)
        p = scenes[0]["video_prompts"][s["storymem_shot_num"] - 1]
        total += 1
        if hashlib.sha256(p.encode("utf-8")).hexdigest() != s["prompt_sha256"]: pbad.append((eid, s))
print("shot counts:", dict(cnt), "total shots:", total, "prompt mismatches:", len(pbad))