summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-04-25 14:51:41 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-04-25 14:51:41 +0300
commitf064ff4617b2656a6c70e6675764ea73223e5c91 (patch)
treede879df03562177f09387a187658a7a3f12efb50
parentb4f42f0248008ae3813e972abe264c1d0c326d4c (diff)
Fix removing old vid
-rw-r--r--src/tasks.ts5
1 files 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);