Enabled custom yt-dlp arguments in settings.json

This commit is contained in:
2022-06-04 15:03:24 +02:00
parent 7dd812050a
commit 52cffed0dc
7 changed files with 131 additions and 95 deletions

View File

@@ -2,8 +2,8 @@ import { spawn } from 'child_process';
import { join } from 'path';
import { Readable } from 'stream';
import { ISettings } from '../interfaces/ISettings';
import Logger from '../utils/BetterLogger';
import { availableParams } from '../utils/params';
import Logger from '../utils/BetterLogger';
const log = new Logger();
@@ -45,6 +45,7 @@ class Process {
const ytldp = spawn(this.exePath,
['-o', `${this.settings?.download_path || 'downloads/'}%(title)s.%(ext)s`]
.concat(sanitizedParams)
.concat((this.settings?.cliArgs ?? []).map(arg => arg.split(' ')).flat())
.concat([this.url])
);

View File

@@ -17,7 +17,7 @@ const log = new Logger();
const pool = new ProcessPool();
try {
settings = require('../settings.json');
settings = require('../../settings.json');
}
catch (e) {
new Promise(resolve => setTimeout(resolve, 500))

View File

@@ -1,3 +1,4 @@
export interface ISettings {
download_path: string
download_path: string,
cliArgs?: string[],
}

View File

@@ -1,4 +1,4 @@
export const availableParams = [
'--no-mtime',
'-x'
'-x',
]