Cache base64 encoded video data to local file Args: base64_data: Base64 encoded video data (without data:video/... prefix) Returns: Local cache filename
(self, base64_data: str)
| 443 | raise Exception(normalized_error) from e |
| 444 | |
| 445 | async def cache_base64_video(self, base64_data: str) -> str: |
| 446 | """Cache base64 encoded video data to local file |
| 447 | |
| 448 | Args: |
| 449 | base64_data: Base64 encoded video data (without data:video/... prefix) |
| 450 | |
| 451 | Returns: |
| 452 | Local cache filename |
| 453 | """ |
| 454 | import base64 as _b64 |
| 455 | import uuid as _uuid |
| 456 | |
| 457 | unique_id = hashlib.md5(f"{_uuid.uuid4()}{time.time()}".encode()).hexdigest() |
| 458 | filename = f"{unique_id}.mp4" |
| 459 | file_path = self.cache_dir / filename |
| 460 | |
| 461 | try: |
| 462 | video_data = _b64.b64decode(base64_data) |
| 463 | self._write_cached_content(file_path, video_data) |
| 464 | debug_logger.log_info(f"Base64 video cached: {filename} ({len(video_data)} bytes)") |
| 465 | return filename |
| 466 | except Exception as e: |
| 467 | debug_logger.log_error( |
| 468 | error_message=f"Failed to cache base64 video: {str(e)}", |
| 469 | status_code=0, |
| 470 | response_text="" |
| 471 | ) |
| 472 | raise Exception(f"Failed to cache base64 video: {str(e)}") |
| 473 | |
| 474 | async def cache_base64_image(self, base64_data: str, resolution: str = "") -> str: |
| 475 | """ |
no test coverage detected