Fix yt-dlp file creation and clean video pipeline

This commit is contained in:
2026-08-14 19:59:33 +05:00
parent 144dd3cb52
commit bcdb352cca
+2 -6
View File
@@ -6,6 +6,7 @@ import os
import sys import sys
import tempfile import tempfile
import time import time
import uuid
from dataclasses import dataclass from dataclasses import dataclass
from pathlib import Path from pathlib import Path
from typing import Any, Optional, Set from typing import Any, Optional, Set
@@ -101,12 +102,7 @@ class MediaProcessor:
self, url: str, prefix: str = "video_" self, url: str, prefix: str = "video_"
) -> tuple[Optional[Path], Optional[str], bool]: ) -> tuple[Optional[Path], Optional[str], bool]:
"""Returns (path, error_message, is_permanent_error)""" """Returns (path, error_message, is_permanent_error)"""
tmp = tempfile.NamedTemporaryFile( output_path = self.cache_dir / f"{prefix}{uuid.uuid4().hex[:12]}.mp4"
dir=self.cache_dir, prefix=prefix, suffix=".mp4", delete=False
)
output_path = Path(tmp.name)
tmp.close()
await register_active_path(output_path) await register_active_path(output_path)
max_size = self.max_video_bytes max_size = self.max_video_bytes
netrc_path = None netrc_path = None