mirror of
https://github.com/tedkulp/vidgrab
synced 2026-03-05 13:20:27 -05:00
Allow posting directly to /queue. Uses "best" format if not passed.
This commit is contained in:
@@ -3,8 +3,8 @@ export class UploadDto {
|
||||
}
|
||||
|
||||
export class QueueDto {
|
||||
format: number;
|
||||
format? = 'best';
|
||||
url: string;
|
||||
title: string;
|
||||
extractor: string;
|
||||
title?: string;
|
||||
extractor?: string;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,12 @@ export class WebController {
|
||||
@Redirect('/')
|
||||
@UsePipes(new ValidationPipe({ transform: true }))
|
||||
async queue(@Body() body: QueueDto) {
|
||||
if (!body.extractor || !body.title) {
|
||||
const videoInfo = await this.ytdlService.getVideoInfo(body.url);
|
||||
body.extractor = videoInfo.extractor;
|
||||
body.title = videoInfo.title;
|
||||
}
|
||||
|
||||
const job = await this.vidgrabQueue.add('download', body);
|
||||
|
||||
// Redirect to main page
|
||||
|
||||
Reference in New Issue
Block a user