@@ -452,15 +452,20 @@ async def download_via_ytdlp(url: str, args: str):
452452 f"Executing command: { ' ' .join (shlex .quote (part ) for part in full_command )} "
453453 )
454454
455- process = await asyncio .create_subprocess_exec (
456- * full_command ,
457- stdout = subprocess .PIPE ,
458- stderr = subprocess .PIPE ,
459- env = {** os .environ , "PYTHONUNBUFFERED" : "1" },
460- )
461-
462455 full_command_str = " " .join (full_command )
463456
457+ try :
458+ process = await asyncio .create_subprocess_exec (
459+ * full_command ,
460+ stdout = subprocess .PIPE ,
461+ stderr = subprocess .PIPE ,
462+ env = {** os .environ , "PYTHONUNBUFFERED" : "1" },
463+ )
464+
465+ except Exception as e :
466+ logging .exception (f"Failed to start process: { full_command_str } " )
467+ raise HTTPException (status_code = 500 , detail = f"Failed to start process: { e } " )
468+
464469 return StreamingResponse (
465470 _stream_subprocess_output (process , url , full_command_str ),
466471 media_type = "text/event-stream" ,
@@ -573,7 +578,7 @@ def delete_downloaded_file(filename: str):
573578 try :
574579 os .remove (full_path )
575580
576- media_exts = [".mp3" , ".mp4" , ".m4a" , ".mkv" ]
581+ media_exts = [".mp3" , ".mp4" , ".m4a" , ".mkv" , ".webm" ]
577582 exts = [".info.json" , ".description" , ".webp" , ".png" , ".jpeg" , ".jpg" ]
578583
579584 other_media_files = any (
0 commit comments