|
@@ -3,6 +3,15 @@ import commander = require('commander');
|
|
|
import fs = require('fs');
|
|
|
import path = require('path');
|
|
|
import series from './series';
|
|
|
+import log = require('./log');
|
|
|
+
|
|
|
+/* correspondances between resolution and value CR excpect */
|
|
|
+let resol_table: { [id: string]: IResolData; } = {
|
|
|
+ '360': {quality:'60', format:'106'},
|
|
|
+ '480': {quality:'61', format:'106'},
|
|
|
+ '720': {quality:'62', format:'106'},
|
|
|
+ '1080': {quality:'80', format:'108'},
|
|
|
+};
|
|
|
|
|
|
/**
|
|
|
* Streams the batch of series to disk.
|
|
@@ -12,6 +21,28 @@ export default function(args: string[], done: (err?: Error) => void)
|
|
|
const config = parse(args);
|
|
|
const batchPath = path.join(config.output || process.cwd(), 'CrunchyRoll.txt');
|
|
|
|
|
|
+ // set resolution
|
|
|
+ if (config.resolution)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ config.video_format = resol_table[config.resolution]['format'];
|
|
|
+ config.video_quality = resol_table[config.resolution]['quality'];
|
|
|
+ }
|
|
|
+ catch(e)
|
|
|
+ {
|
|
|
+ log.warn("Invalid resolution " + config.resolution + "p. Setting to 1080p")
|
|
|
+ config.video_format = resol_table['1080']['format'];
|
|
|
+ config.video_quality = resol_table['1080']['quality'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /* 1080 by default */
|
|
|
+ config.video_format = resol_table['1080']['format'];
|
|
|
+ config.video_quality = resol_table['1080']['quality'];
|
|
|
+ }
|
|
|
+
|
|
|
tasks(config, batchPath, (err, tasks) =>
|
|
|
{
|
|
|
if (err)
|
|
@@ -151,5 +182,6 @@ function parse(args: string[]): IConfigLine
|
|
|
.option('-s, --series <s>', 'The series override.')
|
|
|
.option('-n, --filename <s>', 'The name override.')
|
|
|
.option('-t, --tag <s>', 'The subgroup. (Default: CrunchyRoll)')
|
|
|
+ .option('-r, --resolution <s>', 'The video resolution. (Default: 1080 (360, 480, 720, 1080))')
|
|
|
.parse(args);
|
|
|
}
|