#!/usr/bin/env python3 """setrow.py PDFPAGE PRINTED KIND NOTES — mark one manifest.tsv row done. python3 tools/setrow.py 20 18 plate "plate 1" src_file is derived from the PDF page (blank for kind dropped/colophon).""" import sys pdf, printed, kind, notes = sys.argv[1:5] rows = open("manifest.tsv").read().splitlines() out = [] for i, line in enumerate(rows): c = line.split("\t") if i and c[0] == pdf: src = "" if kind in ("dropped", "colophon") else f"src/pages/p{int(pdf):04d}.tex" line = "\t".join([c[0], c[1], printed, kind, "done", src, notes]) out.append(line) open("manifest.tsv", "w").write("\n".join(out) + "\n") print(" | ".join(out[int(pdf)].split("\t")))