1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-29 11:22:18 +00:00

Fix passing arguments to Utils.ts (#137)

This commit is contained in:
Adrian Calinescu
2020-05-18 20:15:22 +03:00
committed by GitHub
parent d9617df5ed
commit 3cf49c5d1c
2 changed files with 3 additions and 4 deletions

View File

@@ -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;