"""One-time migration of existing Iran and Armenia photo groups.""" import json from pathlib import Path import sys ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "photo-upload")) from highlights import normalize_highlights ART = ROOT / "_art" IRAN = ( "0b1781e580e6d0852728b6aab4f45f0eded30394ea8ff74d9d7ce8ae326bd172", "a85137ab7990cb095c8043cf21c034663795194e5510f26a7175edf5a5489017", ) ARMENIA = ( "bcf8d1409da4d748b2ba060fc090bbe5a518f033f3e971e95f89a8add5c74ace", "3c708b27ab8e8af18bd3ad8ce25876be653b366551f065f31800d8c640b56278", "474ab3283ce8801ac6e59b67b65b4169167053873a5a8db4a15b840a3448266c", ) for path in ART.glob("*photo-*.md"): if not path.name.startswith("2026-"): continue job = path.name.split("-photo-", 1)[1][:64] name = "Iran" if job in IRAN else "Armenia" if job in ARMENIA else None if job == "7c832afa1b73023d8f2391ff40c221be9ffd468a1a96a6bf4900cbf95595d31d": index = int(path.stem[-2:]) name = "Armenia" if index >= 4 else None if not name: continue content = path.read_text() if "highlight_name:" not in content: content = content.replace("categories: art\n", "categories: art\n" + f"highlight_name: {json.dumps(name)}\n", 1) path.write_text(content) normalize_highlights(ART)