${title}
-
${type}
+
${type === "video" ? "video" : "audio"}
@@ -546,8 +581,8 @@ function download(type) {
`${path.join(downloadDir, filename + `.${ext}`)}`,
"--ffmpeg-location",
ffmpeg,
- subs,
- autoSubs
+ // subs,
+ // autoSubs
],
{ shell: true, detached: false },
controller.signal
@@ -566,13 +601,20 @@ function download(type) {
`${path.join(downloadDir, filename + `.${ext}`)}`,
"--ffmpeg-location",
ffmpeg,
- subs,
- autoSubs
+ // subs,
+ // autoSubs
],
{ shell: true, detached: false },
controller.signal
);
} else if (type === "extract") {
+ if (extractFormat == "alac") {
+ extractExt = "m4a";
+ } else if (extractFormat == "vorbis") {
+ extractExt = "ogg";
+ } else {
+ extractExt = extractFormat;
+ }
downloadProcess = ytdlp.exec(
[
url,
@@ -580,7 +622,7 @@ function download(type) {
"--audio-format",
extractFormat,
"-o",
- `${path.join(downloadDir, filename + `.${extractFormat}`)}`,
+ `${path.join(downloadDir, filename + `.${extractExt}`)}`,
"--ffmpeg-location",
ffmpeg,
],
@@ -597,15 +639,16 @@ function download(type) {
downloadProcess
.on("progress", (progress) => {
- if (progress == 100){
- getId(randomId + "prog").textContent = i18n.__("Processing")
- }
- else{
- getId(randomId + "prog").textContent = `${i18n.__("Progress")}: ${
- progress.percent
- }% ${i18n.__("Speed")}: ${progress.currentSpeed || 0}`;
- }
-
+ // if (progress.percent == 100) {
+ // getId(randomId + "prog").textContent =
+ // i18n.__("Processing") + "...";
+ // } else {
+ getId(randomId + "prog").textContent = `${i18n.__(
+ "Progress"
+ )}: ${progress.percent}% ${i18n.__("Speed")}: ${
+ progress.currentSpeed || 0
+ }`;
+ // }
const items = JSON.parse(localStorage.getItem("itemList"));
// Clearing item from localstorage
@@ -620,27 +663,32 @@ function download(type) {
.once("ytDlpEvent", (eventType, eventData) => {
getId(randomId + "prog").textContent = i18n.__("Downloading...");
})
- .on("close", () => {
+ .once("close", () => {
if (willBeSaved) {
- const items = JSON.parse(localStorage.getItem("itemList"));
- // Clearing item from localstorage
- for (let item of items) {
- if (item.id == randomId) {
- items.splice(items.indexOf(item), 1);
- break;
- }
- }
- localStorage.setItem("itemList", JSON.stringify(items));
-
+ // const items = JSON.parse(localStorage.getItem("itemList"));
+ // // Clearing item from localstorage
+ // for (let item of items) {
+ // if (item.id == randomId) {
+ // items.splice(items.indexOf(item), 1);
+ // break;
+ // }
+ // }
+ // localStorage.setItem("itemList", JSON.stringify(items));
+
+ // If extration is done
if (type === "extract") {
- console.log(path.join(downloadDir, filename + `.${extractFormat}`));
+ console.log(
+ path.join(downloadDir, filename + `.${extractFormat}`)
+ );
afterSave(
downloadDir,
- filename + `.${extractFormat}`,
+ filename + `.${extractExt}`,
randomId + "prog"
);
- } else {
+ }
+ // If download is done
+ else {
console.log(path.join(downloadDir, filename + `.${ext}`));
afterSave(
downloadDir,
@@ -650,13 +698,14 @@ function download(type) {
}
}
})
- .on("error", (error) => {
+ .once("error", (error) => {
getId(randomId + "prog").textContent = i18n.__(
"Some error has occured. Hover to see details"
);
getId(randomId + "prog").title = error.message;
console.log(error.message);
- });
+ })
+
}
// Removing item
@@ -682,9 +731,14 @@ function fadeItem(id) {
function afterSave(location, filename, progressId) {
const notify = new Notification("ytDownloader", {
- body: i18n.__("File saved successfully"),
+ body: i18n.__("File saved. Click to Open"),
icon: "../assets/images/icon.png",
- });
+ })
+
+ notify.onclick = () =>{
+ showItem(finalLocation, finalFilename);
+ }
+
let finalLocation = location;
let finalFilename = filename;
if (os.platform() === "win32") {
diff --git a/translations/en.json b/translations/en.json
index 5c0465f..210a15e 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -5,7 +5,7 @@
"Download location": "Download location",
"Current download location - ": "Current download location - ",
"Enable transparent dark mode(only Linux, needs relaunch)": "Enable transparent dark mode(only Linux, needs relaunch)",
- "Please wait, yt-dlp is being downloaded": "Please wait, yt-dlp is being downloaded",
+ "Please wait, necessary files are being downloaded": "Please wait, necessary files are being downloaded",
"Video": "Video",
"Audio": "Audio",
"Title ": "Title ",
@@ -26,7 +26,7 @@
"here": "here",
"Processing": "Processing",
"Some error has occured. Check your network and use correct URL":"Some error has occured. Check your network and use correct URL",
- "Failed to download yt-dlp. Please check your network and try again": "Failed to download yt-dlp. Please check your network and try again",
+ "Failed to download necessary files. Please check your network and try again": "Failed to download necessary files. Please check your network and try again",
"Try again":"Try again",
"Unknown size":"Unknown size",
"MB":"MB",
@@ -44,6 +44,7 @@
"Download subtitles if available":"Download subtitles if available",
"Download auto generated subtitles":"Download auto generated subtitles",
"Extract Audio from Video":"Extract Audio from Video",
- "Extract":"Extract"
+ "Extract":"Extract",
+ "Downloading necessary files":"Downloading necessary files"
}