()
| 57 | |
| 58 | |
| 59 | def main(): |
| 60 | parser = argparse.ArgumentParser() |
| 61 | parser.add_argument("--output-dir", default="tests/resources/goldens") |
| 62 | args = parser.parse_args() |
| 63 | |
| 64 | if not os.path.exists(args.output_dir): |
| 65 | os.makedirs(args.output_dir) |
| 66 | |
| 67 | for video_path in VIDEOS: |
| 68 | if not os.path.exists(video_path): |
| 69 | print(f"Skipping {video_path}, not found.") |
| 70 | continue |
| 71 | |
| 72 | video_name = os.path.basename(video_path) |
| 73 | for detector_class, params, suffix in DETECTORS: |
| 74 | detector_name = detector_class.__name__ |
| 75 | print(f"Generating golden for {video_name} with {detector_name} ({suffix})...") |
| 76 | try: |
| 77 | cuts = generate_golden(video_path, detector_class, params) |
| 78 | output_filename = f"{video_name}.{detector_name}.{suffix}.json" |
| 79 | output_path = os.path.join(args.output_dir, output_filename) |
| 80 | with open(output_path, "w") as f: |
| 81 | json.dump({"cuts": cuts}, f) |
| 82 | except Exception as e: |
| 83 | print(f"Failed to generate golden for {video_name} with {detector_name}: {e}") |
| 84 | |
| 85 | |
| 86 | if __name__ == "__main__": |
no test coverage detected