|
|
|
@ -3,6 +3,7 @@ const { default: YTDlpWrap } = require("yt-dlp-wrap-extended");
|
|
|
|
const path = require("path");
|
|
|
|
const path = require("path");
|
|
|
|
const os = require("os");
|
|
|
|
const os = require("os");
|
|
|
|
const { platform } = require("os");
|
|
|
|
const { platform } = require("os");
|
|
|
|
|
|
|
|
const { get } = require("http");
|
|
|
|
let url;
|
|
|
|
let url;
|
|
|
|
const ytDlp = localStorage.getItem("ytdlp");
|
|
|
|
const ytDlp = localStorage.getItem("ytdlp");
|
|
|
|
const ytdlp = new YTDlpWrap(ytDlp);
|
|
|
|
const ytdlp = new YTDlpWrap(ytDlp);
|
|
|
|
@ -62,6 +63,7 @@ function download(type) {
|
|
|
|
let playlistName;
|
|
|
|
let playlistName;
|
|
|
|
|
|
|
|
|
|
|
|
getId("options").style.display = "none";
|
|
|
|
getId("options").style.display = "none";
|
|
|
|
|
|
|
|
getId("openDownloads").style.display = "inline-block"
|
|
|
|
getId("pasteLink").style.display = "none";
|
|
|
|
getId("pasteLink").style.display = "none";
|
|
|
|
getId("playlistName").textContent = i18n.__("Processing") + "...";
|
|
|
|
getId("playlistName").textContent = i18n.__("Processing") + "...";
|
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +90,7 @@ function download(type) {
|
|
|
|
"-o",
|
|
|
|
"-o",
|
|
|
|
`"${path.join(
|
|
|
|
`"${path.join(
|
|
|
|
downloadDir,
|
|
|
|
downloadDir,
|
|
|
|
"Playlist_vid_%(playlist_id)s",
|
|
|
|
"%(playlist_title)s",
|
|
|
|
"%(playlist_index)s.%(title)s.%(ext)s"
|
|
|
|
"%(playlist_index)s.%(title)s.%(ext)s"
|
|
|
|
)}"`,
|
|
|
|
)}"`,
|
|
|
|
"--ffmpeg-location",
|
|
|
|
"--ffmpeg-location",
|
|
|
|
@ -111,7 +113,7 @@ function download(type) {
|
|
|
|
"-o",
|
|
|
|
"-o",
|
|
|
|
`"${path.join(
|
|
|
|
`"${path.join(
|
|
|
|
downloadDir,
|
|
|
|
downloadDir,
|
|
|
|
"Playlist_aud_%(playlist_id)s",
|
|
|
|
"%(playlist_title)s",
|
|
|
|
"%(playlist_index)s.%(title)s.%(ext)s"
|
|
|
|
"%(playlist_index)s.%(title)s.%(ext)s"
|
|
|
|
)}"`,
|
|
|
|
)}"`,
|
|
|
|
"--ffmpeg-location",
|
|
|
|
"--ffmpeg-location",
|
|
|
|
@ -134,13 +136,11 @@ function download(type) {
|
|
|
|
// Opening folder
|
|
|
|
// Opening folder
|
|
|
|
if (type === "video") {
|
|
|
|
if (type === "video") {
|
|
|
|
folderLocation = path.join(
|
|
|
|
folderLocation = path.join(
|
|
|
|
downloadDir,
|
|
|
|
downloadDir
|
|
|
|
"Playlist_vid_" + playlistId
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
folderLocation = path.join(
|
|
|
|
folderLocation = path.join(
|
|
|
|
downloadDir,
|
|
|
|
downloadDir
|
|
|
|
"Playlist_aud_" + playlistId
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (platform() == "win32") {
|
|
|
|
if (platform() == "win32") {
|
|
|
|
@ -167,13 +167,13 @@ function download(type) {
|
|
|
|
|
|
|
|
|
|
|
|
if (count > 1) {
|
|
|
|
if (count > 1) {
|
|
|
|
getId(`p${count - 1}`).textContent = i18n.__(
|
|
|
|
getId(`p${count - 1}`).textContent = i18n.__(
|
|
|
|
"File saved. Click to Open"
|
|
|
|
"File saved."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const item = `<div class="playlistItem">
|
|
|
|
const item = `<div class="playlistItem">
|
|
|
|
<p class="itemTitle">${itemTitle}</p>
|
|
|
|
<p class="itemTitle">${itemTitle}</p>
|
|
|
|
<p class="itemProgress" onclick="openFolder('${folderLocation}')" id="p${count}">${i18n.__(
|
|
|
|
<p class="itemProgress" id="p${count}">${i18n.__(
|
|
|
|
"Downloading..."
|
|
|
|
"Downloading..."
|
|
|
|
)}</p>
|
|
|
|
)}</p>
|
|
|
|
</div>`;
|
|
|
|
</div>`;
|
|
|
|
@ -202,8 +202,10 @@ function download(type) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
downloadProcess.on("close", () => {
|
|
|
|
downloadProcess.on("close", () => {
|
|
|
|
getId(`p${count}`).textContent = i18n.__("File saved. Click to Open");
|
|
|
|
getId(`p${count}`).textContent = i18n.__("File saved.");
|
|
|
|
getId("pasteLink").style.display = "inline-block";
|
|
|
|
getId("pasteLink").style.display = "inline-block";
|
|
|
|
|
|
|
|
getId("openDownloads").style.display = "none"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const notify = new Notification("ytDownloader", {
|
|
|
|
const notify = new Notification("ytDownloader", {
|
|
|
|
body: i18n.__("Playlist downloaded"),
|
|
|
|
body: i18n.__("Playlist downloaded"),
|
|
|
|
@ -246,6 +248,10 @@ function closeMenu() {
|
|
|
|
}, 50);
|
|
|
|
}, 50);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getId("openDownloads").addEventListener("click", () => {
|
|
|
|
|
|
|
|
openFolder(downloadDir)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
getId("preferenceWin").addEventListener("click", () => {
|
|
|
|
getId("preferenceWin").addEventListener("click", () => {
|
|
|
|
closeMenu();
|
|
|
|
closeMenu();
|
|
|
|
ipcRenderer.send("load-page", __dirname + "/preferences.html");
|
|
|
|
ipcRenderer.send("load-page", __dirname + "/preferences.html");
|
|
|
|
|