initialize

This commit is contained in:
2026-04-09 08:47:37 +00:00
commit b80e97799f
22 changed files with 3015 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import shutil
import uuid
from pathlib import Path
from typing import Tuple
from fastapi import UploadFile
from app.config import UPLOAD_DIR
def save_upload(file: UploadFile) -> Tuple[str, str]:
suffix = Path(file.filename or "").suffix.lower() or ".mp4"
file_id = f"{uuid.uuid4().hex}{suffix}"
destination = UPLOAD_DIR / file_id
with destination.open("wb") as buffer:
shutil.copyfileobj(file.file, buffer)
return file_id, file.filename or file_id
def get_upload_path(file_id: str) -> Path:
return UPLOAD_DIR / file_id