Files
torrent_backend/routes/startup.py
2024-05-10 16:44:46 +04:00

18 lines
536 B
Python

from fastapi import APIRouter
from pathlib import Path
startup_router = APIRouter()
@startup_router.on_event("startup")
def startup():
need_paths = [
Path() / "content" / "images" / "cover" / "full_size",
Path() / "content" / "images" / "cover" / "preview",
Path() / "content" / "images" / "screenshot" / "full_size",
Path() / "content" / "images" / "screenshot" / "preview",
Path() / "content" / "torrent"
]
for path in need_paths:
path.mkdir(parents=True, exist_ok=True)