from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import Any from scripts.video_analysis import download_video, extract_keyframes, extract_transcript, ocr_frames from scripts.video_analysis.error_types import ErrorInfo, make_error PIPELINE_STAGES: list[str] = ["transcript", "download", "keyframes", "ocr", "report"] @dataclass class ReportContext: url: str slug: str output_dir: Path @dataclass class _Ok: value: Any def is_ok(self) -> bool: return True def is_err(self) -> bool: return False @dataclass class _Err: err: ErrorInfo def is_ok(self) -> bool: return False def is_err(self) -> bool: return True def ok(value: Any) -> _Ok: return _Ok(value) def err(error: ErrorInfo) -> _Err: return _Err(error) def build_report_stub(slug: str, url: str, video_id: str) -> str: return f"""#