From e058b8e69909f2605f3d95069e07b6331cb81633 Mon Sep 17 00:00:00 2001 From: Godzil Date: Mon, 27 Apr 2020 22:37:23 +0100 Subject: [PATCH] We want to save the video format/quality infos in the config file. --- src/batch.ts | 36 +++++++++++++++++++++++------------- src/config.ts | 2 -- src/interface/IConfig.d.ts | 1 + 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/batch.ts b/src/batch.ts index 248cd49..432525f 100644 --- a/src/batch.ts +++ b/src/batch.ts @@ -38,19 +38,14 @@ export default function(args: string[], done: (err?: Error) => void) config.nametmpl = '{SERIES_TITLE} - s{SEASON_NUMBER}e{EPISODE_NUMBER} - {EPISODE_TITLE} - [{TAG}]'; } - // Update the config file with new parameters - cfg.save(config); - - if (config.unlog) + if (config.tag === undefined) { - config.crDeviceId = undefined; - config.user = undefined; - config.pass = undefined; - my_request.eatCookies(config); - cfg.save(config); - log.info('Unlogged!'); + config.tag = 'CrunchyRoll'; + } - process.exit(0); + if (config.sublang === undefined) + { + config.sublang = [ 'enUS' ]; } // set resolution @@ -75,6 +70,21 @@ export default function(args: string[], done: (err?: Error) => void) config.video_quality = resol_table['1080'].quality; } + // Update the config file with new parameters + cfg.save(config); + + if (config.unlog) + { + config.crDeviceId = undefined; + config.user = undefined; + config.pass = undefined; + my_request.eatCookies(config); + cfg.save(config); + log.info('Unlogged!'); + + process.exit(0); + } + if (config.debug) { /* Ugly but meh */ @@ -388,8 +398,8 @@ function parse(args: string[]): IConfigLine .option('-s, --series ', 'The series name override.') .option('--ignoredub', 'Experimental: Ignore all seasons where the title end with \'Dub)\'') .option('-n, --nametmpl ', 'Output name template') - .option('-t, --tag ', 'The subgroup.', 'CrunchyRoll') - .option('-r, --resolution ', 'The video resolution. (valid: 360, 480, 720, 1080)', '1080') + .option('-t, --tag ', 'The subgroup.') + .option('-r, --resolution ', 'The video resolution. (valid: 360, 480, 720, 1080)') .option('-b, --batch ', 'Batch file', 'CrunchyRoll.txt') .option('--verbose', 'Make tool verbose') .option('--debug', 'Create a debug file. Use only if requested!') diff --git a/src/config.ts b/src/config.ts index c862b0a..bfdc92c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -71,8 +71,6 @@ export function save(config: IConfig) tmp.cache = undefined; tmp.episodes = undefined; tmp.series = undefined; - tmp.video_format = undefined; - tmp.video_quality = undefined; tmp.rebuildcrp = undefined; tmp.batch = undefined; tmp.verbose = undefined; diff --git a/src/interface/IConfig.d.ts b/src/interface/IConfig.d.ts index 7952070..9b44a87 100644 --- a/src/interface/IConfig.d.ts +++ b/src/interface/IConfig.d.ts @@ -8,6 +8,7 @@ interface IConfig { episodes?: string; // Settings crlang?: string; + sublang?: any; format?: string; output?: string; series?: string;