From 6515ebf39bf4a776331ca929b8f68b2ec0d3763a Mon Sep 17 00:00:00 2001 From: aandrew-me Date: Mon, 27 Jan 2025 17:41:36 +0300 Subject: [PATCH] Fix playlist wrong download dir --- html/playlist.html | 1 + src/playlist.js | 10 +++++++++- src/renderer.js | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/html/playlist.html b/html/playlist.html index 56b6259..1eb492f 100644 --- a/html/playlist.html +++ b/html/playlist.html @@ -175,6 +175,7 @@
+
diff --git a/src/playlist.js b/src/playlist.js index 0f79b6b..96edd85 100644 --- a/src/playlist.js +++ b/src/playlist.js @@ -13,7 +13,7 @@ let downloadDir = localStorage.getItem("downloadPath") || downloadsDir; try { console.log("Trying to access", downloadDir) fs.accessSync(downloadDir, constants.W_OK); - downloadDir = downloadsDir; + downloadDir = downloadDir; } catch (err) { console.log("Unable to write to download directory. Switching to default one.") console.log("Err:", err) @@ -305,6 +305,14 @@ function download(type) { } } + + getId("finishBtn").addEventListener("click", () => { + controller.abort("user_finished") + try { + process.kill(downloadProcess.ytDlpProcess.pid, 'SIGHINT') + } catch (_error) {} + }) + downloadProcess.on("ytDlpEvent", (_eventType, eventData) => { // console.log(eventData); diff --git a/src/renderer.js b/src/renderer.js index 6ba7f6d..6179d3a 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -401,7 +401,7 @@ async function getInfo(url) { * @typedef {import("./types").format} format * @type {format[]} */ - const formats = parsedInfo.formats; + const formats = parsedInfo.formats || []; console.log(formats); /**