From c707d4fef63ae29e894bbc2aae57e8488a978ed9 Mon Sep 17 00:00:00 2001 From: aandrew-me Date: Sat, 19 Nov 2022 22:43:11 +0600 Subject: [PATCH] Make playlist download changes --- html/playlist.html | 6 ++++++ src/playlist.js | 24 +++++++++++++++--------- translations/en.json | 4 +++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/html/playlist.html b/html/playlist.html index 914de1d..e14be61 100644 --- a/html/playlist.html +++ b/html/playlist.html @@ -20,6 +20,11 @@ margin-top: 15px; font-weight: bold; } + #openDownloads{ + display:none; + position: relative; + bottom:8px; + } @@ -80,6 +85,7 @@

+
diff --git a/src/playlist.js b/src/playlist.js index c67f705..52a639d 100644 --- a/src/playlist.js +++ b/src/playlist.js @@ -3,6 +3,7 @@ const { default: YTDlpWrap } = require("yt-dlp-wrap-extended"); const path = require("path"); const os = require("os"); const { platform } = require("os"); +const { get } = require("http"); let url; const ytDlp = localStorage.getItem("ytdlp"); const ytdlp = new YTDlpWrap(ytDlp); @@ -62,6 +63,7 @@ function download(type) { let playlistName; getId("options").style.display = "none"; + getId("openDownloads").style.display = "inline-block" getId("pasteLink").style.display = "none"; getId("playlistName").textContent = i18n.__("Processing") + "..."; @@ -88,7 +90,7 @@ function download(type) { "-o", `"${path.join( downloadDir, - "Playlist_vid_%(playlist_id)s", + "%(playlist_title)s", "%(playlist_index)s.%(title)s.%(ext)s" )}"`, "--ffmpeg-location", @@ -111,7 +113,7 @@ function download(type) { "-o", `"${path.join( downloadDir, - "Playlist_aud_%(playlist_id)s", + "%(playlist_title)s", "%(playlist_index)s.%(title)s.%(ext)s" )}"`, "--ffmpeg-location", @@ -134,13 +136,11 @@ function download(type) { // Opening folder if (type === "video") { folderLocation = path.join( - downloadDir, - "Playlist_vid_" + playlistId + downloadDir ); } else { folderLocation = path.join( - downloadDir, - "Playlist_aud_" + playlistId + downloadDir ); } if (platform() == "win32") { @@ -167,13 +167,13 @@ function download(type) { if (count > 1) { getId(`p${count - 1}`).textContent = i18n.__( - "File saved. Click to Open" + "File saved." ); } const item = `

${itemTitle}

-

${i18n.__( +

${i18n.__( "Downloading..." )}

`; @@ -202,8 +202,10 @@ function download(type) { }); 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("openDownloads").style.display = "none" + const notify = new Notification("ytDownloader", { body: i18n.__("Playlist downloaded"), @@ -246,6 +248,10 @@ function closeMenu() { }, 50); } +getId("openDownloads").addEventListener("click", () => { + openFolder(downloadDir) +}) + getId("preferenceWin").addEventListener("click", () => { closeMenu(); ipcRenderer.send("load-page", __dirname + "/preferences.html"); diff --git a/translations/en.json b/translations/en.json index caadfb6..a83419f 100644 --- a/translations/en.json +++ b/translations/en.json @@ -69,5 +69,7 @@ "Maximum number of active downloads":"Maximum number of active downloads", "Preferred video quality": "Preferred video quality", "Preferred audio format": "Preferred audio format", - "Best": "Best" + "Best": "Best", + "File saved.":"File saved.", + "Open download folder":"Open download folder" }