From 894de923b91f43577749d619129622d0ac4378a2 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 26 Jul 2019 17:59:41 -0700 Subject: [PATCH] Fixed: Don't reject standard/absolute numbering mismatch due to season number --- .../MatchesFolderSpecificationFixture.cs | 14 ++++++++++++++ .../Specifications/MatchesFolderSpecification.cs | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs index 1a1367f45..6bf5ec207 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs @@ -192,5 +192,19 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications Subject.IsSatisfiedBy(localEpisode, null).Accepted.Should().BeTrue(); } + + [Test] + public void should_be_accepted_if_file_has_absolute_episode_number_and_folder_uses_standard() + { + _localEpisode.FileEpisodeInfo.SeasonNumber = 0; + _localEpisode.FileEpisodeInfo.AbsoluteEpisodeNumbers = new[] { 1 }; + + _localEpisode.FolderEpisodeInfo.SeasonNumber = 1; + _localEpisode.FolderEpisodeInfo.EpisodeNumbers = new[] { 1, 2 }; + + _localEpisode.Path = @"C:\Test\Unsorted\Series.Title.S01.720p.HDTV-Sonarr\S02E01.mkv".AsOsAgnostic(); + + Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeTrue(); + } } } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs index e390b37eb..43503d2b2 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs @@ -48,7 +48,13 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications _logger.Debug("No file ParsedEpisodeInfo, skipping check"); return Decision.Accept(); } - + + if (fileInfo.IsAbsoluteNumbering) + { + _logger.Debug("File uses absolute episode numbering, skipping check"); + return Decision.Accept(); + } + if (folderInfo.SeasonNumber != fileInfo.SeasonNumber) { return Decision.Reject("Season number {0} was unexpected considering the folder name {1}", fileInfo.SeasonNumber, folderInfo.ReleaseTitle);