| import json | |
| from pathlib import Path | |
| from ylff.services.scene_catalog import build_scene_catalog | |
| def test_build_scene_catalog_from_local_manifests(tmp_path: Path): | |
| # Create two fake bundles with manifest.json files | |
| b1 = tmp_path / "capture_a" | |
| b2 = tmp_path / "capture_b" | |
| b1.mkdir() | |
| b2.mkdir() | |
| (b1 / "manifest.json").write_text( | |
| json.dumps( | |
| { | |
| "schema_version": "1.0", | |
| "capture_id": "cap_a", | |
| "operating_regime": "indoor_constrained", | |
| "scene_type": "RESIDENTIAL_LIVING", | |
| "difficulty_flags": ["mirror"], | |
| "devices": [ | |
| { | |
| "device_id": "iphone_a", | |
| "device_type": "iphone", | |
| "video_path": "devices/iphone_a/video.mov", | |
| "intrinsics_path": "devices/iphone_a/intrinsics.json", | |
| "timestamps_path": "devices/iphone_a/timestamps.json", | |
| } | |
| ], | |
| } | |
| ) | |
| ) | |
| (b2 / "manifest.json").write_text( | |
| json.dumps( | |
| { | |
| "schema_version": "1.0", | |
| "capture_id": "cap_b", | |
| "operating_regime": "outdoor_urban", | |
| "devices": [], | |
| } | |
| ) | |
| ) | |
| cat = build_scene_catalog([str(b1 / "manifest.json"), str(b2 / "manifest.json")]) | |
| assert cat.summary["num_scenes"] == 2 | |
| assert any(s.capture_id == "cap_a" for s in cat.scenes) | |
| assert any(s.capture_id == "cap_b" for s in cat.scenes) | |