#!/usr/bin/env python3 """Turn the year-writer workflow output (JSON {years: {'1991': [{name,slot,desc},...]}}) into per-year TSV manifests (art_wardrobe91.tsv ... art_wardrobe99.tsv). Template + slugify are IDENTICAL to build_wardrobe_manifest.py / server.py _art_slug — that contract is load-bearing. usage: python3 tools/build_wardrobe_decade.py descriptions.json""" import json, os, re, sys ROOT = os.path.join(os.path.dirname(__file__), '..') slug = lambda s: re.sub(r'[^a-z0-9]+', '_', s.lower()).strip('_') VIEW = {'hat': 'front view', 'top': 'front view laid flat with the sleeves down', 'bottom': 'front view laid perfectly flat on the ground', 'shoes': 'the pair side by side, front view'} TAIL = ('floating centered on a plain pure white background, painterly stylized 3d game ' 'illustration, full item visible, no body, no person, no mannequin, no hanger, ' 'no coat hanger, no text, no logos') data = json.load(open(sys.argv[1]))['years'] total = 0 for year, items in sorted(data.items()): out = os.path.join(ROOT, 'tools', f'art_wardrobe{year[2:]}.tsv') with open(out, 'w') as fh: fh.write(f'# {len(items)} wardrobe items — {year} ranges, 704x704 doll garment layers.\n') for it in items: s = it['slot'] if s not in VIEW: print('SKIP bad slot', it); continue stem = f"{s}_i_{slug(it['name'])}" fh.write(f"{stem}\t" f"paper doll clothing item for a dress-up game, {it['desc']}, " f"{year} australia, {VIEW[s]}, {TAIL}\n") total += 1 print('wrote', out, len(items)) print('total prompts:', total)