advanced settings for format
This commit is contained in:
parent
da356b70ff
commit
f1d7b8453f
2 changed files with 16 additions and 14 deletions
|
@ -88,7 +88,6 @@ router.get('/status/:uuid', function (req, res ,next) {
|
|||
|
||||
router.get('/format', function (req, res ,next) {
|
||||
let url;
|
||||
let i = 0;
|
||||
try {
|
||||
url = new URL(req.query.url);
|
||||
} catch (e) {
|
||||
|
@ -100,17 +99,22 @@ router.get('/format', function (req, res ,next) {
|
|||
youtubedl.exec(url.href, ['--dump-json'], {}, function(err, output) {
|
||||
if (err) throw err
|
||||
let json = JSON.parse(output);
|
||||
console.log(req.query.advanced);
|
||||
json.formats.forEach(format => {
|
||||
if (format.vcodec === 'none' || format.acodec === 'none')
|
||||
if (req.query.advanced === 'false' && (format.vcodec === 'none' || format.acodec === 'none'))
|
||||
return;
|
||||
|
||||
i++;
|
||||
formats.push({ext: format.ext, id: format.format_id, note: `${format.width}x${format.height}`});
|
||||
let note = `${format.width}x${format.height}`;
|
||||
|
||||
if (req.query.advanced === 'true') {
|
||||
note = format.format
|
||||
}
|
||||
|
||||
formats.push({ext: format.ext, id: format.format_id, note: note});
|
||||
});
|
||||
|
||||
return res.send(formats);
|
||||
});
|
||||
return;
|
||||
});
|
||||
|
||||
router.post('/', async function(req, res, next) {
|
||||
|
|
|
@ -65,16 +65,14 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
|
|||
<option value="mp3">MP3</option>
|
||||
<option value="flac">FLAC</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field has-addon">
|
||||
<div class="control">
|
||||
</div>
|
||||
<div class="control">
|
||||
<label for="advanced" class="checkbox">
|
||||
<input class="checkbox" type="checkbox" name="advanced" id="advanced" title="Advanced" onclick="CheckFormat()">
|
||||
Advanced (Prone to errors!)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="field is-horizontal level">
|
||||
<div class="field-body">
|
||||
<div class="field is-horizontal">
|
||||
|
@ -251,7 +249,7 @@ Come take a look here https://git.namejeff.xyz/Supositware/jeff-downloader for a
|
|||
|
||||
console.log(encodeURI(url.href));
|
||||
let xhttp = new XMLHttpRequest();
|
||||
xhttp.open("get", `/format?url=${url.href}`, true);
|
||||
xhttp.open("get", `/format?url=${url.href}&advanced=${document.getElementById("advanced").checked}`, true);
|
||||
xhttp.send();
|
||||
xhttp.addEventListener("load", function(event) {
|
||||
console.log(event.target.responseText);
|
||||
|
|
Loading…
Reference in a new issue