# -*- coding: utf-8 -*-
import io, sys, os, re, json
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
todo=json.load(open("todo_upgrade.json",encoding="utf-8"))
idx=open("index_main.html",encoding="utf-8").read()
prog_seg=idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
prog_dets=set(re.findall(r'url:"(details/[^"]+)"',prog_seg))
prog_ids=set(re.findall(r'\{id:"([^"]+)"',prog_seg))
# 已核验 det
todo=[t for t in todo if t["det"] not in prog_dets]
print("todo 未入 PROGRAMS:",len(todo))
from collections import Counter
print(Counter(t["s"] for t in todo).most_common())
print("\n=== CMU 候选 ===")
for t in todo:
    if t["s"]=="cmu":
        print(t["det"].split("/")[-1], "|", t.get("deg",""), "|", t["en"][:55], "|", t.get("disc",""), "|", t["url"][:60])
print("\n=== Rice 候选 ===")
for t in todo:
    if t["s"]=="rice":
        print(t["det"].split("/")[-1], "|", t.get("deg",""), "|", t["en"][:55], "|", t.get("disc",""), "|", t["url"][:60])
