Update `ignoredub` to support more form
(and also make it work with multiple languages)
This commit is contained in:
parent
1f20e028e1
commit
9f73e4f865
@ -23,6 +23,25 @@ export function localeToCC(locale: string): string
|
||||
return ret;
|
||||
}
|
||||
|
||||
const dubignore_regexp: { [id: string]: RegExp; } =
|
||||
{
|
||||
en: /\(.*Dub(?:bed)?.*\)|(?:\(RU\))/i,
|
||||
fr: /\(.*Dub(?:bed)?.*\)|(?:\(RU\))|\(?Doublage.*\)?/,
|
||||
de: /\(.*isch\)|\(Dubbed\)|\(RU\)/
|
||||
};
|
||||
|
||||
export function get_diregexp(config: IConfig): RegExp
|
||||
{
|
||||
let ret = dubignore_regexp.en;
|
||||
|
||||
if (config.crlang in dubignore_regexp)
|
||||
{
|
||||
ret = dubignore_regexp[config.crlang];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const episodes_regexp: { [id: string]: RegExp; } =
|
||||
{
|
||||
en: /Episode\s+((OVA)|(PV )?[S0-9][\-P0-9.]*[a-fA-F]?)\s*$/i,
|
||||
|
||||
@ -239,7 +239,9 @@ function pageScrape(config: IConfig, task: IConfigTask, done: (err: any, result?
|
||||
const episode = regexp.exec($(el).children('.series-title').text());
|
||||
const url = $(el).attr('href');
|
||||
|
||||
if (config.ignoredub && (season_name.endsWith('Dub)') || season_name.endsWith('dub)')))
|
||||
const igndub_re = languages.get_diregexp(config);
|
||||
|
||||
if (config.ignoredub && (igndub_re.exec(season_name)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user