From f064ff4617b2656a6c70e6675764ea73223e5c91 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 25 Apr 2025 14:51:41 +0300 Subject: Fix removing old vid --- src/tasks.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tasks.ts b/src/tasks.ts index 7497f3a..0b220bb 100644 --- a/src/tasks.ts +++ b/src/tasks.ts @@ -13,9 +13,10 @@ export const checkIfYtdlpIsInstalled = async () => { export const runDownloadUrlTask = async (task: Task) => { try { const filename = "veeti.mp4"; + const filepath = `downloads/${filename}`; // remove the file if it exists try { - fs.rmSync(filename); + fs.rmSync(filepath); } catch (e: any) { if (e.code !== "ENOENT") { console.error("Error deleting file", e); @@ -23,7 +24,7 @@ export const runDownloadUrlTask = async (task: Task) => { } const { stdout } = await asyncExec( - `yt-dlp --cookies-from-browser chromium -o "downloads/${filename}" "${task.url}"`, + `yt-dlp --cookies-from-browser chromium -o "${filepath}" "${task.url}"`, ); console.log(stdout); task.respondWithFile(filename); -- cgit v1.3