#!/usr/bin/env python3
"""Load the sanitized EGXO release 2.0.0 public catalog."""
import csv, io, json, sys
from urllib.request import urlopen
URL = "https://egxodata.com/datasets/egxo-household-egocentric-video-evaluation/releases/2.0.0/catalog.csv"
text = urlopen(sys.argv[1] if len(sys.argv) > 1 else URL, timeout=30).read().decode()
rows = list(csv.DictReader(io.StringIO(text)))
print(json.dumps({"records": len(rows), "duration_seconds": sum(float(r["duration_seconds"]) for r in rows)}, indent=2))
