#!/usr/bin/env python3 """Monster High picker v5 — Style A "Editorial Light" + dark mode. - light theme default (auto follows system), manual toggle in header - bursts collapsed to one motion cell; tap opens group with RANGE + copy button - lightbox: arrows/swipe, favorite, counter - live sync: every selection POSTs to /picks on the mini (no download needed) Usage: python3 build_picker_v5.py bursts.json """ import json, sys from pathlib import Path SHOOT = Path("/Volumes/Sam Storage/YellowMellow/2026/Monster High Theme (10:01:2026)") PRE = SHOOT / "ClientPicker" / "Previews" OUT = SHOOT / "Monster High - Photo Picker.html" ids = sorted(p.stem for p in PRE.glob("*.jpg") if not p.name.startswith("._")) assert ids, "no previews" idset = set(ids) bursts = json.load(open(sys.argv[1])) burst_frames, frame_burst = {}, {} for k, v in bursts.items(): a, b = int(v["first"][4:]), int(v["last"][4:]) fr = ["7O9A%04d" % n for n in range(a, b + 1) if "7O9A%04d" % n in idset] if not fr: continue burst_frames[k] = fr for f in fr: frame_burst[f] = k def pretty(i): return i[:4] + "-" + i[4:] cells, n_singles = [], 0 for i in ids: chip, attrs, cls = "", "", "" if i in frame_burst: k = frame_burst[i] if burst_frames[k][0] == i: chip = 'MOTION ×%d' % len(burst_frames[k]) attrs = ' data-burst="%s"' % k cls = " motion" else: attrs = ' data-burstframe="%s"' % k else: n_singles += 1 src = ("ClientPicker/Bursts/%s.webp" % k) if "data-burst=" in attrs else ("ClientPicker/Thumbs/%s.jpg" % i) cells.append( '
' '%s
' '
%s
' % (cls, i, attrs, src, chip, pretty(i))) js_bursts = json.dumps(burst_frames) n_visible = len([c for c in cells if "data-burstframe" not in c]) html = """ Monster High Theme — Photo Picks

Monster High Theme

Oct 01, 2026 · __N__ photos 0 selected
Tap a photo to enlarge — arrows or swipe move between photos. Tap the dot (or the button in the enlarged view) to select. MOTION cells open their full sequence.
__CELLS__
""" html = html.replace("__CELLS__", "\n".join(cells)).replace("__BURSTS__", js_bursts).replace("__N__", str(n_visible)) OUT.write_text(html, encoding="utf-8") print("built %d photos (%d visible cells) -> %s (%.1f KB)" % (len(ids), n_visible, OUT, OUT.stat().st_size / 1024))