From a9f8b02f0891587f36989c33fbe70cdf642fe1a3 Mon Sep 17 00:00:00 2001 From: beppe9000 <6625123+beppe9000@users.noreply.github.com> Date: Sat, 15 Aug 2020 15:38:01 +0200 Subject: [PATCH] fix typo & sanitize video names on win32 (#205) * fix typo & sanitize video names on win32 * add warning for invalid path --- src/CommandLineParser.ts | 6 +++--- src/VideoUtils.ts | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CommandLineParser.ts b/src/CommandLineParser.ts index 5c15b5f..d682c8d 100644 --- a/src/CommandLineParser.ts +++ b/src/CommandLineParser.ts @@ -72,7 +72,7 @@ export const argv: any = yargs.options({ }, closedCaptions: { alias: 'cc', - describe: 'Check if closed captions are aviable and let the user choose which one to download (will not ask if only one aviable)', + describe: 'Check if closed captions are available and let the user choose which one to download (will not ask if only one available)', type: 'boolean', default: false, demandOption: false @@ -183,8 +183,8 @@ function isOutputTemplateValid(argv: any): boolean { while (match) { if (!templateElements.includes(match[1])) { logger.error( - `'${match[0]}' is not aviable as a template element \n` + - `Aviable templates elements: '${templateElements.join("', '")}' \n`, + `'${match[0]}' is not available as a template element \n` + + `Available templates elements: '${templateElements.join("', '")}' \n`, { fatal: true } ); diff --git a/src/VideoUtils.ts b/src/VideoUtils.ts index a9592f5..526f359 100644 --- a/src/VideoUtils.ts +++ b/src/VideoUtils.ts @@ -24,14 +24,14 @@ function publishedTimeToString(date: string): string { const minutes: string = dateJs.getMinutes().toString(); const seconds: string = dateJs.getSeconds().toString(); - return `${hours}:${minutes}:${seconds}`; + return `${hours}.${minutes}.${seconds}`; } function isoDurationToString(time: string): string { const duration: Duration = parseDuration(time); - return `${duration.hours ?? '00'}:${duration.minutes ?? '00'}:${duration.seconds?.toFixed(0) ?? '00'}`; + return `${duration.hours ?? '00'}.${duration.minutes ?? '00'}.${duration.seconds?.toFixed(0) ?? '00'}`; } @@ -152,8 +152,12 @@ export function createUniquePath(videos: Array