diff --git a/assets/css/index.css b/assets/css/index.css index 8438750..58d0864 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -109,7 +109,7 @@ body { color: var(--text); margin: 10px auto; border-radius: 10px; - padding: 20px 10px; + padding: 10px; align-items: center; justify-content: space-between; } @@ -131,7 +131,10 @@ body { width: 90%; } } - +.itemIconBox{ + display:flex; + flex-direction: column; +} .itemIcon { max-width: 160px; max-height: 90px; @@ -141,6 +144,7 @@ body { .itemTitle { font-family: sans-serif; + padding:5px; } .itemBody { height: 90%; @@ -155,6 +159,12 @@ body { margin-top: 10px; font-family: sans-serif; } +.progressBar{ + width:90%; +} +.itemSpeed{ + padding:10px 5px 5px 5px; +} .itemClose { position: absolute; top: 5px; @@ -167,6 +177,7 @@ body { .itemType { font-style: italic; margin-top: 5px; + margin: top 8px; } #closeHidden { diff --git a/src/playlist_new.js b/src/playlist_new.js index 12bb7f2..0f77784 100644 --- a/src/playlist_new.js +++ b/src/playlist_new.js @@ -79,31 +79,50 @@ function pasteLink() { const parsed = JSON.parse(stdout); console.log(parsed); let items = ""; - parsed.entries.forEach((entry) => { - const randId = Math.random().toFixed(10).toString().slice(2); - - if (entry.channel) { - items += ` -
- No thumbnail - -
-
${entry.title}
-
${formatTime(entry.duration)}
- + // If correct playlist url is used + if (parsed.entries) { + parsed.entries.forEach((entry) => { + const randId = Math.random() + .toFixed(10) + .toString() + .slice(2); + + if (entry.channel) { + items += ` +
+ No thumbnail + +
+
${entry.title}
+
${formatTime(entry.duration)}
+ +
-
- `; - } - }); - getId("data").innerHTML = items; - getId("loadingWrapper").style.display = "none"; + `; + } + }); + getId("data").innerHTML = items; + getId("loadingWrapper").style.display = "none"; + } + // If correct playlist url is not used + else { + getId("loadingWrapper").style.display = "none"; + getId("incorrectMsg").textContent = i18n.__( + "Incompatible URL. Please provide a playlist URL" + ); + getId("errorDetails").innerHTML = ` + URL: ${clipboardText} +

+ ${error} + `; + getId("errorDetails").title = i18n.__("Click to copy"); + getId("errorBtn").style.display = "inline-block"; + } } } ); - } getId("pasteLink").addEventListener("click", (e) => { diff --git a/src/renderer.js b/src/renderer.js index e765f20..d3d159e 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -209,9 +209,9 @@ function defaultVideoToggle() { defaultWindow = localStorage.getItem("defaultWindow"); } if (defaultWindow == "video") { - selectVideo() + selectVideo(); } else { - selectAudio() + selectAudio(); } } @@ -530,13 +530,14 @@ getId("videoDownload").addEventListener("click", (event) => { const randId = Math.random().toFixed(10).toString().slice(2); const item = `
+
No thumbnail - + ${i18n.__("Video")} +
${title}
-
${i18n.__("Video")}

${i18n.__("Download pending")}

@@ -588,11 +589,12 @@ getId("audioDownload").addEventListener("click", (event) => { const item = `
+
No thumbnail - + ${i18n.__("Video")} +
${title}
-
${i18n.__("Video")}

${i18n.__("Download pending")}

@@ -643,11 +645,12 @@ getId("extractBtn").addEventListener("click", () => { const item = `
+
No thumbnail - + ${i18n.__("Video")} +
${title}
-
${i18n.__("Video")}

${i18n.__("Download pending")}

@@ -827,18 +830,22 @@ function download( const newItem = `
+
+ No thumbnail + ${ + type === "video" ? i18n.__("Video") : i18n.__("Audio") + } +
- No thumbnail +
${newTitle}
-
${ - type === "video" ? i18n.__("Video") : i18n.__("Audio") - }
+
@@ -999,11 +1006,12 @@ function download( getId(randomId + "prog").textContent = i18n.__("Processing") + "..."; } else { - getId(randomId + "prog").textContent = `${i18n.__( - "Progress" - )}: ${progress.percent}% ${i18n.__("Speed")}: ${ + getId(randomId + "speed").textContent = `${i18n.__("Speed")}: ${ progress.currentSpeed || 0 }`; + getId( + randomId + "prog" + ).innerHTML = ``; } // const items = JSON.parse(localStorage.getItem("itemList")); @@ -1020,6 +1028,7 @@ function download( getId(randomId + "prog").textContent = i18n.__("Downloading..."); }) .once("close", (code) => { + getId(randomId + "speed").textContent = "" currentDownloads--; console.log("Closed with code " + code); if (code == 0) {