This commit is contained in:
Marek Lenczewski
2026-04-07 18:01:34 +02:00
parent ca988345e9
commit 375a9cd386
5 changed files with 73 additions and 65 deletions

View File

@@ -1,4 +1,5 @@
import subprocess
import threading
from pathlib import Path
from database.database import SessionLocal
@@ -8,6 +9,10 @@ VIDEOS_DIR = "/videos"
MIN_VALID_SIZE = 1024 * 100 # 100 KB
def downloadAsync(videoId: int, youtubeUrl: str):
threading.Thread(target=downloadVideo, args=(videoId, youtubeUrl)).start()
def downloadVideo(videoId: int, youtubeUrl: str):
outputPath = f"{VIDEOS_DIR}/{videoId}.mp4"