update
This commit is contained in:
@@ -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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user