format selection enabled

This commit is contained in:
2022-06-03 15:52:39 +02:00
parent 92158cc599
commit 368595c08f
16 changed files with 223 additions and 33 deletions

View File

@@ -83,14 +83,16 @@ class Process {
fps: format.fps ?? '',
resolution: format.resolution ?? '',
vcodec: format.vcodec ?? '',
acodec: format.acodec ?? '',
}
}),
}).filter((format: IDownloadInfoSection) => format.format_note !== 'storyboard'),
best: {
format_id: json.format_id ?? '',
format_note: json.format_note ?? '',
fps: json.fps ?? '',
resolution: json.resolution ?? '',
vcodec: json.vcodec ?? '',
acodec: json.acodec ?? '',
},
thumbnail: json.thumbnail,
title: json.title,

View File

@@ -31,7 +31,6 @@ catch (e) {
export async function getFormatsAndInfo(socket: Socket, url: string) {
let p = new Process(url, [], settings);
const formats = await p.getInfo();
console.log(formats)
socket.emit('available-formats', formats)
p = null;
}
@@ -102,7 +101,7 @@ export async function retrieveDownload(socket: Socket) {
coldRestart = false;
let downloads = [];
// sanitize
downloads = [... new Set(downloads.filter(el => el !== undefined))];
downloads = [...new Set(downloads.filter(el => el !== undefined))];
log.info('dl', `Cold restart, retrieving ${downloads.length} jobs`)
for (const entry of downloads) {
if (entry) {

View File

@@ -2,7 +2,7 @@ import { stat, createReadStream } from 'fs';
import { lookup } from 'mime-types';
export function streamer(ctx: any, next: any) {
const filepath = '/Users/marco/dev/homebrew/yt-dlp-web-ui/downloads/AleXa (알렉사) Voting Open in American Song Contest Grand Final!.webm'
const filepath = ''
stat(filepath, (err, stat) => {
if (err) {
ctx.response.status = 404;

View File

@@ -11,4 +11,5 @@ interface IDownloadInfoSection {
fps: number,
resolution: string,
vcodec: string,
acodec: string,
}

View File

@@ -48,9 +48,12 @@ io.on('connection', socket => {
socket.on('send-url', (args) => {
logger('ws', args?.url)
//if (args.url) getFormatsAndInfo(socket, args?.url)
download(socket, args)
})
socket.on('send-url-format-selection', (args) => {
logger('ws', args?.url)
if (args.url) getFormatsAndInfo(socket, args?.url)
})
socket.on('abort', (args) => {
abortDownload(socket, args)
})