diff --git a/html/index.html b/html/index.html index 3385b48..987672c 100644 --- a/html/index.html +++ b/html/index.html @@ -18,7 +18,7 @@
-

Download particular time-range

+

Download particular time-range

@@ -110,14 +110,13 @@

- -

Subtitles

+
@@ -131,7 +130,7 @@ - + diff --git a/package.json b/package.json index f8d6d68..a3bf892 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "package.json", "./assets/**/*", "./src/**/*", - "ffmpeg*" + "ffmpeg*", + "translations" ], "mac": { "category": "Utility", diff --git a/src/renderer.js b/src/renderer.js index 0c36b79..b1ea7b6 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -2,9 +2,9 @@ const cp = require("child_process"); const os = require("os"); let ffmpeg; if (os.platform() === "win32") { - ffmpeg = __dirname + "\\..\\ffmpeg.exe"; + ffmpeg = `"${__dirname}\\..\\ffmpeg.exe"`; } else { - ffmpeg = __dirname + "/../ffmpeg"; + ffmpeg = `"${__dirname}/../ffmpeg"`; } const fs = require("fs"); @@ -27,8 +27,8 @@ let downloadDir = ""; // Global variables let title, onlyvideo, id, thumbnail, ytdlp, duration, extractFormat; let rangeCmd = ""; -let subs = "" -let autoSubs = "" +// let subs = "" +// let autoSubs = "" let rangeOption = "--download-sections"; let willBeSaved = true; @@ -64,10 +64,44 @@ if (os.platform() == "win32") { // Downloading yt-dlp async function downloadYtdlp() { - document.querySelector("#popupBox p").textContent = "Downloading yt-dlp"; + document.querySelector("#popupBox p").textContent = i18n.__( + "Please wait, necessary files are being downloaded" + ); getId("popupSvg").style.display = "inline"; - await YTDlpWrap.downloadFromGithub(ytdlpDownloadPath); + // Downloading appropriate version of yt-dlp + if (os.platform() == "linux") { + // Checking python version + try { + const result = cp.execSync("python3 --version", { + encoding: "utf-8", + }); + const minorVersion = Number(result.split(" ")[1].split(".")[1]); + if (minorVersion >= 7) { + await YTDlpWrap.downloadFromGithub(ytdlpDownloadPath); + } else { + // Downloading full binary if python version is less than 3.7 + await YTDlpWrap.downloadFromGithub( + ytdlpDownloadPath, + "", + "linux", + true + ); + } + } catch (error) { + // Downloading full binary of python3 is not there + await YTDlpWrap.downloadFromGithub( + ytdlpDownloadPath, + "", + "linux", + true + ); + } + } else { + // In case of windows + await YTDlpWrap.downloadFromGithub(ytdlpDownloadPath); + } + getId("popupBox").style.display = "none"; ytDlp = ytdlpPath; ytdlp = new YTDlpWrap(ytDlp); @@ -84,7 +118,7 @@ cp.exec("yt-dlp --version", (error, stdout, stderr) => { getId("popupBox").style.display = "block"; process.on("uncaughtException", (reason, promise) => { document.querySelector("#popupBox p").textContent = i18n.__( - "Failed to download yt-dlp. Please check your network and try again" + "Failed to download necessary files. Please check your network and try again" ); getId("popupSvg").style.display = "none"; getId("popup").innerHTML += `