mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
305b5485b9
Adapted from the original feature commits, retaining their author credit: [0a955971](https://github.com/FractalEngineer/psxrecomp/commit/0a95597129cc2ee6d70397a8da9511831575eae4) [0a4cf21f](https://github.com/FractalEngineer/psxrecomp/commit/0a4cf21fac88ef425ba0edd25871d7dd20ee0903) [22bdc9e9](https://github.com/FractalEngineer/psxrecomp/commit/22bdc9e90d14f7a04b79c83b77611c4eb980fef4) [734977c9](https://github.com/FractalEngineer/psxrecomp/commit/734977c93e80789e9210a262daa35a88f41c40d4) Source scope and current-master validation: docs/internal/upstream/atomic-stereo-render-views.md Co-authored-by: Yves <calibratedbeats@gmail.com>
22 lines
803 B
Python
22 lines
803 B
Python
"""Write host-owned stereo manifests from TCP metadata and complete PNG sets."""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
|
|
def write_capture_manifests(directory, records):
|
|
directory = Path(directory)
|
|
written = 0
|
|
for record in records:
|
|
pair_id = int(record["pair_id"])
|
|
if pair_id < 0:
|
|
raise ValueError("negative capture pair ID")
|
|
prefix = f"p{pair_id:06d}"
|
|
images = [directory / f"{prefix}_{eye}.png" for eye in ("left", "right", "sbs")]
|
|
if not all(path.is_file() and path.stat().st_size for path in images):
|
|
continue
|
|
manifest = directory / f"{prefix}.json"
|
|
if not manifest.exists():
|
|
manifest.write_text(json.dumps(record, indent=2) + "\n", encoding="utf-8")
|
|
written += 1
|
|
return written
|