mirror of
https://github.com/snobu/destreamer.git
synced 2026-01-16 21:12:13 +00:00
Fix passing arguments to Utils.ts (#137)
This commit is contained in:
@@ -4,7 +4,6 @@ import { execSync } from 'child_process';
|
||||
import colors from 'colors';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { argv } from './CommandLineParser';
|
||||
|
||||
function sanitizeUrls(urls: string[]) {
|
||||
const rex = new RegExp(/(?:https:\/\/)?.*\/video\/[a-z0-9]{8}-(?:[a-z0-9]{4}\-){3}[a-z0-9]{12}$/, 'i');
|
||||
@@ -123,11 +122,11 @@ export function checkRequirements() {
|
||||
}
|
||||
|
||||
|
||||
export function makeUniqueTitle(title: string, outDir: string) {
|
||||
export function makeUniqueTitle(title: string, outDir: string, skip?: boolean, format?: string) {
|
||||
let ntitle = title;
|
||||
let k = 0;
|
||||
|
||||
while (!argv.skip && fs.existsSync(outDir + path.sep + ntitle + '.' + argv.format))
|
||||
while (!skip && fs.existsSync(outDir + path.sep + ntitle + '.' + format))
|
||||
ntitle = title + ' - ' + (++k).toString();
|
||||
|
||||
return ntitle;
|
||||
|
||||
@@ -173,7 +173,7 @@ async function downloadVideo(videoUrls: string[], outputDirectories: string[], s
|
||||
|
||||
console.log(colors.yellow(`\nDownloading Video: ${video.title}\n`));
|
||||
|
||||
video.title = makeUniqueTitle(sanitize(video.title) + ' - ' + video.date, outputDirectories[j]);
|
||||
video.title = makeUniqueTitle(sanitize(video.title) + ' - ' + video.date, outputDirectories[j], argv.skip, argv.format);
|
||||
|
||||
// Very experimental inline thumbnail rendering
|
||||
if (!argv.noExperiments)
|
||||
|
||||
Reference in New Issue
Block a user