Download progress for yt-dlp download and improved error handling

pull/354/head
aandrew-me 2 weeks ago
parent 23e3ee35e8
commit baa3931639

@ -32,6 +32,7 @@
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3" />
</circle>
</svg>
<p id="ytDlpDownloadProgress"></p>
</div>
</div>

12
package-lock.json generated

@ -1,17 +1,17 @@
{
"name": "ytdownloader",
"version": "3.19.2",
"version": "3.20.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ytdownloader",
"version": "3.19.2",
"version": "3.20.0",
"license": "GPL-3.0",
"dependencies": {
"electron-updater": "^6.6.2",
"systeminformation": "^5.25.11",
"yt-dlp-wrap-plus": "^2.3.20"
"yt-dlp-wrap-plus": "^2.4.3"
},
"devDependencies": {
"electron": "^30.0.0",
@ -5122,9 +5122,9 @@
}
},
"node_modules/yt-dlp-wrap-plus": {
"version": "2.3.20",
"resolved": "https://registry.npmjs.org/yt-dlp-wrap-plus/-/yt-dlp-wrap-plus-2.3.20.tgz",
"integrity": "sha512-vKQfQMvvSbTta+mrRrMFYm+e/vkbHK5X9L2LiO3JRVHUmEjzpk8qdFpQwp27FPIA7nLR17AZA5gG9yEVcF3avQ==",
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/yt-dlp-wrap-plus/-/yt-dlp-wrap-plus-2.4.3.tgz",
"integrity": "sha512-D/Q1/gipu8hEmairp5gRyWQE+BsfJanALbkzTxWdTC/LRXlCq00vDdscFxvVrypXT5UGf6KP1gtrKFV087uCEw==",
"license": "MIT"
}
}

@ -2,7 +2,7 @@
"dependencies": {
"electron-updater": "^6.6.2",
"systeminformation": "^5.25.11",
"yt-dlp-wrap-plus": "^2.3.20"
"yt-dlp-wrap-plus": "^2.4.3"
},
"name": "ytdownloader",
"version": "3.20.0",

@ -50,6 +50,7 @@ const CONSTANTS = {
POPUP_BOX_MAC: "popupBoxMac",
POPUP_TEXT: "popupText",
POPUP_SVG: "popupSvg",
YTDLP_DOWNLOAD_PROGRESS: "ytDlpDownloadProgress",
// Menu
MENU_ICON: "menuIcon",
MENU: "menu",
@ -379,19 +380,37 @@ class YtDownloaderApp {
);
try {
await YTDlpWrap.downloadFromGithub(defaultYtDlpPath);
await YTDlpWrap.downloadFromGithub(
defaultYtDlpPath,
undefined,
undefined,
(progress, _d, _t) => {
$(
CONSTANTS.DOM_IDS.YTDLP_DOWNLOAD_PROGRESS
).textContent =
i18n.__("progress") +
`: ${(progress * 100).toFixed(2)}%`;
}
);
$(CONSTANTS.DOM_IDS.POPUP_BOX).style.display = "none";
localStorage.setItem(
CONSTANTS.LOCAL_STORAGE_KEYS.YT_DLP_PATH,
defaultYtDlpPath
);
return defaultYtDlpPath;
} catch (downloadError) {
$(CONSTANTS.DOM_IDS.YTDLP_DOWNLOAD_PROGRESS).textContent = "";
console.error("Failed to download yt-dlp:", downloadError);
document.querySelector("#popupBox p").textContent = i18n.__(
"errorFailedFileDownload"
);
$(CONSTANTS.DOM_IDS.POPUP_SVG).style.display = "none";
throw new Error("Failed to download yt-dlp.");
}
}

Loading…
Cancel
Save