#!/usr/bin/env python3 """Build Monster High picker v3. v2 + Christy feedback: - lightbox: favorite toggle button, prev/next arrows, keyboard, swipe - burst frames: "GIF" badge + animated preview (video) in the cell when JS runs Static fallback unchanged: grid renders without JS; burst cells show still + badge. Usage: python3 build_picker_v3.py [bursts.json] bursts.json: {"7O9A0123": {"first":"7O9A0123","last":"7O9A0134","fps":8}, ...} (burst key = first frame id; video file = ClientPicker/Bursts/.mp4) """ import json, os 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" bursts = {} if len(__import__("sys").argv) > 1: bursts = json.load(open(__import__("sys").argv[1])) # map frame -> burst key (first id) for badge + video lookup frame_burst = {} for k, v in bursts.items(): a, b = int(v["first"][4:]), int(v["last"][4:]) for n in range(a, b + 1): fid = "7O9A%04d" % n if fid in set(ids): frame_burst[fid] = k cells = [] for i in ids: burst_chip = "" src = "ClientPicker/Thumbs/%s.jpg" % i if i in frame_burst: bkey = frame_burst[i] burst_chip = 'GIF' if bursts[bkey]["first"] == i: # lead cell carries the motion preview src = "ClientPicker/Bursts/%s.webp" % bkey cells.append( '
' '
' '%s
%s
' % (i, src, burst_chip, i)) html = """ Monster High Theme — Photo Picks
Static preview — the buttons above need JavaScript. To pick photos, simply tell Sam the numbers of the ones you like.

Monster High Theme

Tap a photo to view it larger — arrows or swipe move between photos. Tap the circle (or the button in the enlarged view) to mark favorites.
0 favorites
__CELLS__
""" html = html.replace("__CELLS__", "\n".join(cells)) OUT.write_text(html, encoding="utf-8") print("built %s photos, %d bursts, %d burst frames -> %s (%.1f KB)" % (len(ids), len(bursts), len(frame_burst), OUT, OUT.stat().st_size / 1024))