From f59b391b28d3c39e2a816bb877d39b7edcf5c7a1 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 25 May 2020 01:05:42 -0400 Subject: [PATCH] Fixed: Don't name with "0" year if no year in db --- frontend/src/Settings/MediaManagement/Naming/NamingModal.js | 3 ++- src/NzbDrone.Core/Organizer/FileNameBuilder.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/Settings/MediaManagement/Naming/NamingModal.js b/frontend/src/Settings/MediaManagement/Naming/NamingModal.js index d2c21b6a8..b925c722b 100644 --- a/frontend/src/Settings/MediaManagement/Naming/NamingModal.js +++ b/frontend/src/Settings/MediaManagement/Naming/NamingModal.js @@ -117,7 +117,8 @@ class NamingModal extends Component { { token: '{Movie Title}', example: 'Movie Title!' }, { token: '{Movie CleanTitle}', example: 'Movie Title' }, { token: '{Movie TitleThe}', example: 'Movie Title, The' }, - { token: '{Movie Certification}', example: 'R' } + { token: '{Movie Certification}', example: 'R' }, + { token: '{Release Year}', example: '2009' } ]; const movieIdTokens = [ diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 155ad573a..5b39f09fa 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -214,6 +214,12 @@ private void AddTagsTokens(Dictionary> tokenHan private void AddReleaseDateTokens(Dictionary> tokenHandlers, int releaseYear) { + if (releaseYear == 0) + { + tokenHandlers["{Release Year}"] = m => string.Empty; + return; + } + tokenHandlers["{Release Year}"] = m => string.Format("{0}", releaseYear.ToString()); //Do I need m.CustomFormat? }