New: More granular book year naming tokens

pull/1064/head
ta264 4 years ago
parent c484a29099
commit a0e2747004

@ -63,7 +63,9 @@ const bookTokens = [
]; ];
const releaseDateTokens = [ const releaseDateTokens = [
{ token: '{Release Year}', example: '2016' } { token: '{Release Year}', example: '2016' },
{ token: '{Release YearFirst}', example: '2015' },
{ token: '{Edition Year}', example: '2016' }
]; ];
const qualityTokens = [ const qualityTokens = [

@ -244,10 +244,32 @@ namespace NzbDrone.Core.Organizer
{ {
tokenHandlers["{Release Year}"] = m => edition.ReleaseDate.Value.Year.ToString(); tokenHandlers["{Release Year}"] = m => edition.ReleaseDate.Value.Year.ToString();
} }
else if (edition.Book.Value.ReleaseDate.HasValue)
{
tokenHandlers["{Release Year}"] = m => edition.Book.Value.ReleaseDate.Value.Year.ToString();
}
else else
{ {
tokenHandlers["{Release Year}"] = m => "Unknown"; tokenHandlers["{Release Year}"] = m => "Unknown";
} }
if (edition.ReleaseDate.HasValue)
{
tokenHandlers["{Edition Year}"] = m => edition.ReleaseDate.Value.Year.ToString();
}
else
{
tokenHandlers["{Edition Year}"] = m => "Unknown";
}
if (edition.Book.Value.ReleaseDate.HasValue)
{
tokenHandlers["{Release YearFirst}"] = m => edition.Book.Value.ReleaseDate.Value.Year.ToString();
}
else
{
tokenHandlers["{Release YearFirst}"] = m => "Unknown";
}
} }
private void AddBookFileTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, BookFile bookFile) private void AddBookFileTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, BookFile bookFile)

Loading…
Cancel
Save