Сделал скелет того, как примерно будет реализован сервис

This commit is contained in:
Viner Abubakirov
2026-02-21 00:19:09 +05:00
parent 8ac132e503
commit 51ec17381f
9 changed files with 62 additions and 34 deletions

View File

@@ -15,7 +15,7 @@ class ChunkUploadBackend(ABC):
"""Загрузка очередного чанка"""
@abstractmethod
def finish(self) -> any:
def finish(self) -> str:
"""Завершение загрузки"""
@abstractmethod
@@ -109,7 +109,7 @@ class S3ChunkUploadBackend(ChunkUploadBackend):
)
# Сбрасываем части
self.parts = []
return response
return response["Location"]
def abort(self) -> None:
if self.upload_id:

View File

@@ -5,6 +5,9 @@ from dataclasses import dataclass
from app.utils.uploader import ChunkUploadBackend
RESOLUTIONS = [240, 360, 480, 720, 1080, 1440, 2160]
@dataclass
class MediaContent:
url: str
@@ -36,7 +39,9 @@ class YtDlpManager:
"""Возвращает title видео"""
return self.info.get("title", "unknown")
def download_video(self, size: Literal[240, 360, 480, 720, 1080, 1440, 2160]):
def download_video(self, size: int):
if size not in RESOLUTIONS:
raise RuntimeError("Unsupported quality")
command = [
"yt-dlp",
"-f",