Browse Source

We want to save the video format/quality infos in the config file.

Godzil 4 years ago
parent
commit
e058b8e699
3 changed files with 24 additions and 15 deletions
  1. 23 13
      src/batch.ts
  2. 0 2
      src/config.ts
  3. 1 0
      src/interface/IConfig.d.ts

+ 23 - 13
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 <s>', 'The series name override.')
     .option('--ignoredub', 'Experimental: Ignore all seasons where the title end with \'Dub)\'')
     .option('-n, --nametmpl <s>', 'Output name template')
-    .option('-t, --tag <s>', 'The subgroup.', 'CrunchyRoll')
-    .option('-r, --resolution <s>', 'The video resolution. (valid: 360, 480, 720, 1080)', '1080')
+    .option('-t, --tag <s>', 'The subgroup.')
+    .option('-r, --resolution <s>', 'The video resolution. (valid: 360, 480, 720, 1080)')
     .option('-b, --batch <s>', 'Batch file', 'CrunchyRoll.txt')
     .option('--verbose', 'Make tool verbose')
     .option('--debug', 'Create a debug file. Use only if requested!')

+ 0 - 2
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;

+ 1 - 0
src/interface/IConfig.d.ts

@@ -8,6 +8,7 @@ interface IConfig {
   episodes?: string;
   // Settings
   crlang?: string;
+  sublang?: any;
   format?: string;
   output?: string;
   series?: string;