Add option to choose mp4/webm in playlist

pull/131/head
Andrew 3 years ago
parent 3dd713c19d
commit 354ea207b7

@ -34,13 +34,15 @@
#advancedMenu {
display: none;
}
#typeSelectBox{
display: none;
}
</style>
</head>
<body>
<!-- Popup message -->
<span id="popupText">Text copied</span>
<!-- Theme toggle -->
<div id="themeToggle" onclick="toggle()">
<div id="themeToggleInside"></div>
@ -82,7 +84,15 @@
<option value="1440">1440p</option>
<option value="2160">2160p (4k)</option>
</select>
<br>
<div id="typeSelectBox">
<label>Select video type</label>
<select id="videoTypeSelect">
<option value="mp4">Mp4</option>
<option value="webm">WebM</option>
</select>
</div>
<br>
<button class="submitBtn" id="download">Download</button>
</div>

@ -248,6 +248,7 @@ ipcMain.on("select-config", () => {
});
ipcMain.on("quit", ()=>{
isQuiting = true;
app.quit()
})

@ -106,6 +106,7 @@ function download(type) {
let quality, format, downloadProcess;
if (type === "video") {
quality = getId("select").value;
videoType = getId("videoTypeSelect").value;
const formatId = formats[quality];
if (quality === "best") {
format = "-f bv*+ba/best";
@ -114,7 +115,12 @@ function download(type) {
} else if (quality === "useConfig") {
format = "";
} else {
format = `-f "${formatId}+m4a/mp4[height=${quality}]+m4a/bv*[height<=${quality}]+ba/best"`;
if (videoType === "mp4"){
format = `-f "${formatId}+m4a/mp4[height=${quality}]+m4a/bv*[height<=${quality}]+ba/best"`;
}
else{
format = `-f "webm[height<=${quality}]+opus/bv*[height<=${quality}]+ba/${formatId}+m4a/mp4[height=${quality}]+m4a/best"`;
}
}
} else {
format = getId("audioSelect").value;
@ -488,6 +494,16 @@ audioToggle.addEventListener("click", (event) => {
getId("audioBox").style.display = "block";
});
getId("select").addEventListener("change", () => {
value = getId("select").value
if (value == "best" || value == "worst" || value == "useConfig"){
getId("typeSelectBox").style.display = "none"
}
else {
getId("typeSelectBox").style.display = "block"
}
})
// More options
let moreOptions = true;

Loading…
Cancel
Save