Fix playlist wrong download dir

This commit is contained in:
aandrew-me 2025-01-27 17:41:36 +03:00
parent 74d33d5181
commit 6515ebf39b
3 changed files with 11 additions and 2 deletions

View File

@ -175,6 +175,7 @@
<div id="list">
</div>
<!-- <button class="advancedToggle" id="finishBtn">Finish downloading</button> -->
<div id="goToTop"></div>
</body>

View File

@ -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);

View File

@ -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);
/**