#!/usr/bin/env python3 """Encode the six requested L31 screenshots as small, pinned JPEGs.""" import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parents[4] SOURCE = ROOT / "Saved/Linux/l31" DEST = Path(__file__).resolve().parent / "captures" DEST.mkdir(parents=True, exist_ok=True) names = ( "fi-column-top-close-v19", "fi-column-top-wide-v19", "fi-column-base-close-v19", "fi-column-base-wide-v19", "fi-floor-v19-tint-off", "fi-floor-v19-tint-on", ) failed = False for name in names: source = SOURCE / f"{name}.png" destination = DEST / f"{name.removesuffix('-v19').replace('-v19-', '-')}.jpg" command = [ "taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", "ffmpeg", "-y", "-hide_banner", "-loglevel", "error", "-i", str(source), "-frames:v", "1", "-q:v", "4", str(destination), ] result = subprocess.run(command, check=False) size = destination.stat().st_size if destination.exists() else 0 ok = result.returncode == 0 and size <= 300_000 failed |= not ok print(f"[L31CaptureJPEG] source={source.name} output={destination.name} " f"bytes={size} status={'PASS' if ok else 'FAIL'}") raise SystemExit(1 if failed else 0)