diff --git a/assets/css/index.css b/assets/css/index.css
index 0bbf2fe..85bab88 100644
--- a/assets/css/index.css
+++ b/assets/css/index.css
@@ -258,7 +258,7 @@ label {
border: none;
outline: none;
border-radius: 5px;
- width: 60px;
+ width: 70px;
font-size: large;
margin: 5px;
}
diff --git a/html/index.html b/html/index.html
index bcf8638..db2241a 100644
--- a/html/index.html
+++ b/html/index.html
@@ -99,9 +99,9 @@
diff --git a/src/renderer.js b/src/renderer.js
index bab8ee4..0eb7b94 100644
--- a/src/renderer.js
+++ b/src/renderer.js
@@ -16,7 +16,9 @@ fs.mkdirSync(tempDir, { recursive: true });
let downloadDir = "";
// Global variables
-let title, onlyvideo, id, thumbnail, ytdlp;
+let title, onlyvideo, id, thumbnail, ytdlp, duration;
+let rangeCmd = "";
+let rangeOption = "--download-sections";
let willBeSaved = true;
function getId(id) {
@@ -150,6 +152,7 @@ async function getInfo(url) {
title = info.title;
id = info.id;
thumbnail = info.thumbnail;
+ duration = info.duration;
const formats = info.formats;
console.log(formats);
@@ -334,12 +337,51 @@ getId("audioDownload").addEventListener("click", (event) => {
// }
// }
+
// restorePrevious()
+
+
+// Time formatting
+
+// function timeFormat(duration) {
+// // Hours, minutes and seconds
+// var hrs = ~~(duration / 3600);
+// var mins = ~~((duration % 3600) / 60);
+// var secs = ~~duration % 60;
+// // Ouput like "1:01" or "4:03:59" or "123:03:59"
+// var ret = "";
+// if (hrs > 0) {
+// ret += "" + hrs + ":" + (mins < 10 ? "0" : "");
+// }
+// ret += "" + mins + ":" + (secs < 10 ? "0" : "");
+// ret += "" + secs;
+// return ret;
+// }
+
+// Manage advanced options
+// function manageAdvanced(duration) {
+// let startTime = getId("startTime").value;
+// let endTime = getId("endTime").value;
+
+// if (startTime && !endTime) {
+// rangeCmd = `*${startTime}-${timeFormat(duration)}`;
+// } else if (!startTime && endTime) {
+// rangeCmd = `*0-${endTime}`;
+// } else if (startTime && endTime) {
+// rangeCmd = `*${startTime}-${endTime}`;
+// } else {
+// rangeOption = "";
+// }
+
+// console.log("Range option: " + rangeOption);
+// console.log("rangeCmd:" + rangeCmd);
+// }
//////////////////////////////
// Downloading with yt-dlp
//////////////////////////////
function download(type) {
+ // manageAdvanced(duration);
const url = getId("url").value;
let ext;
@@ -441,6 +483,8 @@ function download(type) {
downloadProcess = ytdlp.exec(
[
url,
+ // rangeOption,
+ // rangeCmd,
"-f",
`${format_id}+${audioFormat}`,
"-o",
@@ -457,6 +501,8 @@ function download(type) {
downloadProcess = ytdlp.exec(
[
url,
+ rangeOption,
+ rangeCmd,
"-f",
format_id,
"-o",
@@ -507,8 +553,9 @@ function download(type) {
}
})
.on("error", (error) => {
- getId(randomId + "prog").textContent = "Some error has occured"
- })
+ getId(randomId + "prog").textContent = "Some error has occured";
+ console.log(error);
+ });
}
// Removing item