Decode and write the input video. Runs in a thread: up to ~15MB of base64.
(path: Path, video_b64: str, max_size_mb: float)
| 313 | |
| 314 | |
| 315 | def _write_file(path: Path, video_b64: str, max_size_mb: float) -> None: |
| 316 | """Decode and write the input video. Runs in a thread: up to ~15MB of base64.""" |
| 317 | video_data = base64.b64decode(video_b64) |
| 318 | |
| 319 | # Check file size |
| 320 | file_size_mb = len(video_data) / (1024 * 1024) |
| 321 | if file_size_mb > max_size_mb: |
| 322 | raise HTTPException( |
| 323 | status_code=400, |
| 324 | detail=f"Video too large ({file_size_mb:.1f}MB). Maximum allowed: {max_size_mb}MB" |
| 325 | ) |
| 326 | |
| 327 | path.write_bytes(video_data) |
| 328 | |
| 329 | |
| 330 | async def _save_temp_video( |
nothing calls this directly
no outgoing calls
no test coverage detected