Ability to change download directory in homepage

pull/127/head
Andrew 3 years ago
parent 41ec5c3bb9
commit 6a1f6d4728

@ -37,6 +37,7 @@
</div>
<!-- Popup message -->
<span id="popupText">Text copied</span>
<body>
<!-- Theme toggle -->
<div id="themeToggle" onclick="toggle()">
@ -115,6 +116,13 @@
title="If kept empty, it will be downloaded to the end">
<label id="end">End</label>
<br><br>
<div><span id="clText">Current download location - </span><span id="path"></span></div>
<br><br>
<button id="selectLocation" class="submitBtn">Select Download Location</button>
<br><br>
<h3 id="subHeader">Subtitles</h3>
<span id="subTxt">Download subtitles if available</span>

@ -227,7 +227,13 @@ ipcMain.on("select-location", () => {
});
if (location) {
secondaryWindow.webContents.send("downloadPath", location);
if (secondaryWindow){
secondaryWindow.webContents.send("downloadPath", location);
}
else{
win.webContents.send("downloadPath", location);
}
}
});

@ -30,9 +30,9 @@ getId("selectLocation").addEventListener("click", () => {
});
ipcRenderer.on("downloadPath", (event, downloadPath) => {
console.log(downloadPath);
localStorage.setItem("downloadPath", downloadPath);
getId("path").textContent = downloadPath;
console.log(downloadPath[0]);
localStorage.setItem("downloadPath", downloadPath[0]);
getId("path").textContent = downloadPath[0];
});
const enabledTransparent = getId("enableTransparent");

@ -89,6 +89,7 @@ function downloadPathSelection() {
downloadDir = appdir;
localStorage.setItem("downloadPath", appdir);
}
getId("path").textContent = downloadDir;
fs.mkdir(downloadDir, { recursive: true }, () => {});
}
@ -1168,3 +1169,14 @@ getId("newPlaylistWin").addEventListener("click", () => {
ipcRenderer.on("link", (event, text) => {
pasteFromTray(text);
});
// Selecting download directory
getId("selectLocation").addEventListener("click", () => {
ipcRenderer.send("select-location", "");
});
ipcRenderer.on("downloadPath", (event, downloadPath) => {
console.log(downloadPath);
getId("path").textContent = downloadPath;
downloadDir = downloadPath[0]
});
Loading…
Cancel
Save