Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """Verify what configuration is being loaded for each video.""" | |
| import json | |
| from pathlib import Path | |
| OUTPUT_DIR = Path("output") | |
| DATA_CONFIG_DIR = Path("data/config") | |
| def get_video_basename(video_name: str) -> str: | |
| """Get a clean basename from video name.""" | |
| basename = Path(video_name).stem | |
| for char in [" ", ".", "-"]: | |
| basename = basename.replace(char, "_") | |
| while "__" in basename: | |
| basename = basename.replace("__", "_") | |
| return basename.strip("_") | |
| def print_video_config(video_name: str): | |
| """Print configuration for a specific video.""" | |
| basename = get_video_basename(video_name) | |
| print(f"\n{'='*60}") | |
| print(f"VIDEO: {video_name}") | |
| print(f"Config basename: {basename}") | |
| print("=" * 60) | |
| # Check session config | |
| session_config_path = OUTPUT_DIR / f"{basename}_config.json" | |
| if session_config_path.exists(): | |
| with open(session_config_path, "r") as f: | |
| config = json.load(f) | |
| print(f"\n Session Config ({session_config_path.name}):") | |
| print(f" Scorebug: ({config.get('scorebug_x')}, {config.get('scorebug_y')})") | |
| print(f" Flag offset: ({config.get('flag_x_offset')}, {config.get('flag_y_offset')})") | |
| print(f" Flag size: {config.get('flag_width')}x{config.get('flag_height')}") | |
| else: | |
| print(f"\n Session Config: NOT FOUND (expected: {session_config_path})") | |
| # Check timeout config | |
| timeout_config_path = OUTPUT_DIR / f"{basename}_timeout_config.json" | |
| if timeout_config_path.exists(): | |
| print(f" Timeout Config: {timeout_config_path.name}") | |
| else: | |
| print(f" Timeout Config: NOT FOUND") | |
| # Check playclock config | |
| playclock_config_path = OUTPUT_DIR / f"{basename}_playclock_config.json" | |
| if playclock_config_path.exists(): | |
| print(f" Playclock Config: {playclock_config_path.name}") | |
| else: | |
| print(f" Playclock Config: NOT FOUND") | |
| def main(): | |
| print("=" * 80) | |
| print("CONFIGURATION FILES STATUS") | |
| print("=" * 80) | |
| # Known videos | |
| videos = [ | |
| "OSU vs Tenn 12.21.24.mkv", | |
| "OSU vs Texas 01.10.25.mkv", | |
| "OSU vs Oregon 01.01.25.mkv", | |
| "OSU vs ND 01.20.25.mp4", | |
| ] | |
| for video in videos: | |
| print_video_config(video) | |
| # Check for GENERIC configs that might cause confusion | |
| print("\n" + "=" * 80) | |
| print("WARNING: GENERIC CONFIGS (may cause video cross-contamination)") | |
| print("=" * 80) | |
| generic_configs = [ | |
| DATA_CONFIG_DIR / "flag_region.json", | |
| DATA_CONFIG_DIR / "play_clock_region.json", | |
| DATA_CONFIG_DIR / "timeout_tracker_region.json", | |
| ] | |
| for config_path in generic_configs: | |
| if config_path.exists(): | |
| with open(config_path, "r") as f: | |
| config = json.load(f) | |
| source = config.get("source_video", "UNKNOWN") | |
| print(f" {config_path.name}: source={source}") | |
| print(f" -> Scripts should use video-specific configs instead!") | |
| else: | |
| print(f" {config_path.name}: NOT FOUND (OK)") | |
| if __name__ == "__main__": | |
| main() | |