diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs index cab1754dd..9b299aa89 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecificationFixture.cs @@ -1,7 +1,9 @@ using FizzWare.NBuilder; using FluentAssertions; +using Moq; using NUnit.Framework; using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications; +using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common; @@ -131,5 +133,35 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications Subject.IsSatisfiedBy(_localEpisode, null).Accepted.Should().BeFalse(); } + + [Test] + public void should_be_accepted_if_both_file_and_folder_info_map_to_same_special() + { + var title = "Some.Special.S12E00.WEB-DL.1080p-GoodNightTV"; + var actualInfo = Parser.Parser.ParseTitle("Some.Special.S0E100.WEB-DL.1080p-GoodNightTV.mkv"); + + var folderInfo = Parser.Parser.ParseTitle(title); + var fileInfo = Parser.Parser.ParseTitle(title + ".mkv"); + var localEpisode = new LocalEpisode + { + FileEpisodeInfo = fileInfo, + FolderEpisodeInfo = folderInfo, + Series = new Tv.Series + { + Id = 1, + Title = "Some Special" + } + }; + + Mocker.GetMock() + .Setup(v => v.ParseSpecialEpisodeTitle(fileInfo, It.IsAny(), 0, 0, null)) + .Returns(actualInfo); + + Mocker.GetMock() + .Setup(v => v.ParseSpecialEpisodeTitle(folderInfo, It.IsAny(), 0, 0, null)) + .Returns(actualInfo); + + 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 8c85ad958..199fe31fa 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/MatchesFolderSpecification.cs @@ -27,6 +27,11 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications var fileInfo = localEpisode.FileEpisodeInfo; var folderInfo = localEpisode.FolderEpisodeInfo; + if (fileInfo != null && fileInfo.IsPossibleSceneSeasonSpecial) + { + fileInfo = _parsingService.ParseSpecialEpisodeTitle(fileInfo, fileInfo.ReleaseTitle, localEpisode.Series.TvdbId, 0); + } + if (folderInfo != null && folderInfo.IsPossibleSceneSeasonSpecial) { folderInfo = _parsingService.ParseSpecialEpisodeTitle(folderInfo, folderInfo.ReleaseTitle, localEpisode.Series.TvdbId, 0);