#!/usr/bin/env python3"""Put the rolodex's painted materials into the Loom package's catalogue. python3 scripts/import-people-materials.py [<layers directory>]The layers were painted with Codex (29 Oct 2026, after the rolodex picturethe owner chose for People) and cut out of the paintings (keyed off green, thefront card brought to the frame's own card colour, the ring taken in to thepicture's narrower loop, the shadow made from the frame's silhouette, thefelt made seamless at its own colour); the directory holds them as the facelays them (CottonFaces' `Cotton/RolodexFace.swift`, the felt by`FaceGroundSurface`). No word or number is on any of them: the face drawsthe name, the number, the email, the corner, the subtitle and the last-spokeline live, on the painted rules, and the portrait in the print's window. rolodex-frame the rotary card file: its cradle, knobs, axle and rail, the fan of cards behind with their tabs, a blank card in front (the front card is laid over it) rolodex-shadow its shadow on the felt, larger than the frame rolodex-card the front card, blank, its five rules and two notches rolodex-ring one of the two steel rings holding it over the rail rolodex-print the blank square photographic print pasted on itEach is at least 3x the most it is drawn at on a phone (the shadow, a blur,less), declared 3x (2x on the Mac) as the card paper is; the face sets theframe it draws each at. Where the front card stands on the frame, the rail,the card's rules and notches and the print's window, measured off thepaintings, are the face's knobs (`RolodexFaceKnobs`): a repainted layer owesnew ones."""import jsonimport pathlibimport sysHERE = pathlib.Path(__file__).resolve().parentCATALOGUE = HERE.parent / 'apps/loom/Sources/CottonPaper/Media.xcassets'NAMES = ['rolodex-frame', 'rolodex-shadow', 'rolodex-card', 'rolodex-ring', 'rolodex-print']def imageset(name, extension): folder = CATALOGUE / f'{name}.imageset' folder.mkdir(exist_ok=True)for old in folder.iterdir(): old.unlink() contents = {'images': [ {'filename': f'{name}.{extension}', 'idiom': 'universal', 'scale': '3x'}, {'filename': f'{name}.{extension}', 'idiom': 'mac', 'scale': '2x'}, ],'info': {'author': 'xcode', 'version': 1},'properties': {'preserves-vector-representation': False}, } (folder / 'Contents.json').write_text(json.dumps(contents, indent=2) + '\n')return folder / f'{name}.{extension}'def main(source): source = pathlib.Path(source) total = 0for name in NAMES: found = [source / f'{name}.{extension}'for extension in ('png', 'jpg') if (source / f'{name}.{extension}').exists()]if len(found) != 1: sys.exit(f'{source} holds {len(found)} pictures named {name}, not one') picture = found[0] target = imageset(name, picture.suffix[1:]) target.write_bytes(picture.read_bytes()) total += picture.stat().st_size print(f'{picture.name} -> {name}') print(f'{total // 1024} KB in all')if __name__ == '__main__': main(sys.argv[1] if len(sys.argv) > 1else str(pathlib.Path.home() / 'lane-briefs/person-rolodex-face/layers'))