Add an experimental feature: ignoring episodes from season that end with 'dub)' as they are dubbed seasons.

This commit is contained in:
Godzil 2018-08-01 22:08:21 +01:00
parent a679573bf3
commit ed233de565
5 changed files with 15 additions and 1 deletions

View File

@ -344,6 +344,7 @@ function parse(args: string[]): IConfigLine
.option('-f, --format <s>', 'The subtitle format.', 'ass')
.option('-o, --output <s>', 'The output path.')
.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', '{SERIES_TITLE} - s{SEASON_NUMBER}e{EPISODE_NUMBER} - {EPISODE_TITLE} - [{TAG}]')
.option('-t, --tag <s>', 'The subgroup.', 'CrunchyRoll')
.option('-r, --resolution <s>', 'The video resolution. (valid: 360, 480, 720, 1080)', '1080')

View File

@ -57,6 +57,7 @@ export function save(config: IConfig)
tmp.verbose = undefined;
tmp.debug = undefined;
tmp.unlog = undefined;
tmp.ignoredub = undefined;
fs.writeFileSync(configFile, JSON.stringify(tmp, null, ' '));
}

View File

@ -12,6 +12,7 @@ interface IConfig {
series?: string;
nametmpl?: string;
tag?: string;
ignoredub?: boolean;
resolution?: string;
video_format?: string;
video_quality?: string;

View File

@ -1,6 +1,7 @@
interface ISeriesEpisode {
address: string;
episode: string;
seasonName: string;
volume: number;
retry: number;
}

View File

@ -181,6 +181,7 @@ function pageScrape(config: IConfig, task: IConfigTask, done: (err: any, result?
episodes.push({
address: task.address.substr(1),
episode: '',
seasonName: '',
volume: 0,
retry: config.retry,
});
@ -219,22 +220,31 @@ function pageScrape(config: IConfig, task: IConfigTask, done: (err: any, result?
return;
}
const season_name = $(el).closest('ul').prev('a').text();
const volume = /([0-9]+)\s*$/.exec($(el).closest('ul').prev('a').text());
const regexp = /Episode\s+((PV )?[S0-9][\-P0-9.]*[a-fA-F]?)\s*$/i;
const episode = regexp.exec($(el).children('.series-title').text());
const url = $(el).attr('href');
if ((!url) || (!episode)) {
if (config.ignoredub && (season_name.endsWith('Dub)') || season_name.endsWith('dub)')))
{
return;
}
if ((!url) || (!episode))
{
return;
}
episodeCount += 1;
episodes.push({
address: url,
episode: episode[1],
seasonName: season_name,
volume: volume ? parseInt(volume[0], 10) : 1,
retry: config.retry,
});
});
if (episodeCount === 0)
{
log.warn('No episodes found for ' + title + '. Could it be a movie?');