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,10 +1,24 @@
import subprocess
from pathlib import Path
from database.database import SessionLocal
VIDEOS_DIR = "/videos"
CHUNK_SIZE = 64 * 1024
def streamAndSave(videoId: int, youtubeUrl: str):
from model.video import Video # Lazy-Import gegen Zirkular
outputPath = f"{VIDEOS_DIR}/{videoId}.mp4"
yield from streamVideoLive(videoId, youtubeUrl)
if Path(outputPath).exists():
db = SessionLocal()
try:
Video.updateFilePath(db, videoId, outputPath)
finally:
db.close()
def _getStreamUrls(youtubeUrl: str):
result = subprocess.run(
[