download progress bar on taskbar

+ Get the best possible artwork
This commit is contained in:
Araxeus
2021-05-08 07:11:54 +03:00
parent 2168cbca30
commit a8ac2c3af9
6 changed files with 62 additions and 19 deletions

View File

@ -3,3 +3,33 @@ const electron = require("electron");
module.exports.getFolder = (customFolder) =>
customFolder || (electron.app || electron.remote.app).getPath("downloads");
module.exports.defaultMenuDownloadLabel = "Download playlist";
module.exports.UrlToJPG = (imgUrl, videoId) => {
if (!imgUrl || imgUrl.includes(".jpg")) return imgUrl;
if (imgUrl.includes("maxresdefault")) {
return "https://img.youtube.com/vi/"+videoId+"/maxresdefault.jpg";
}
if (imgUrl.includes("hqdefault")) {
return "https://img.youtube.com/vi/"+videoId+"/hqdefault.jpg";
} //it will almost never get further than hq
if (imgUrl.includes("mqdefault")) {
return "https://img.youtube.com/vi/"+videoId+"/mqdefault.jpg";
}
if (imgUrl.includes("sdddefault")) {
return "https://img.youtube.com/vi/"+videoId+"/sdddefault.jpg";
}
return "https://img.youtube.com/vi/"+videoId+"/default.jpg";
}
module.exports.cropMaxWidth = (image) => {
const imageSize = image.getSize();
if (imageSize.width === 1280 && imageSize.height === 720) {
return image.crop({
x: 280,
y: 0,
width: 720,
height: 720
});
}
return image;
}