added custom filenames

This commit is contained in:
ssttevee 2017-03-29 13:59:51 -07:00
parent 361c6cf54c
commit 4dc90aeb00
No known key found for this signature in database
GPG Key ID: 04C1D4F3622920D1
3 changed files with 13 additions and 1 deletions

View File

@ -149,6 +149,7 @@ function parse(args: string[]): IConfigLine
.option('-f, --format <s>', 'The subtitle format. (Default: ass)')
.option('-o, --output <s>', 'The output path.')
.option('-s, --series <s>', 'The series override.')
.option('-n, --filename <s>', 'The name override.')
.option('-t, --tag <s>', 'The subgroup. (Default: CrunchyRoll)')
.parse(args);
}

View File

@ -196,7 +196,17 @@ function name(config: IConfig, page: IEpisodePage, series: string, extra: string
const volume = (volumeNum < 10 ? '0' : '') + page.volume;
const tag = config.tag || 'CrunchyRoll';
return series + ' - s' + volume + 'e' + episode + ' - [' + tag + ']' + extra;
if (!config.filename) {
return page.series + ' - s' + volume + 'e' + episode + ' - [' + tag + ']' + extra;
}
return config.filename
.replace(/{EPISODE_ID}/g, page.id.toString())
.replace(/{EPISODE_NUMBER}/g, episode)
.replace(/{SEASON_NUMBER}/g, volume)
.replace(/{VOLUME_NUMBER}/g, volume)
.replace(/{SERIES_TITLE}/g, series)
.replace(/{TAG}/g, tag) + extra;
}
/**

View File

@ -12,5 +12,6 @@ interface IConfig {
format?: string;
output?: string;
series?: string;
filename?: string;
tag?: string;
}