diff --git a/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs index 522d92f9d..0da5fb02a 100644 --- a/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs @@ -608,5 +608,47 @@ public async Task episode_search_should_use_all_available_numbering_from_service allCriteria.Last().As().SeasonNumber.Should().Be(2); allCriteria.Last().As().EpisodeNumber.Should().Be(3); } + + [Test] + public async Task episode_search_should_include_series_title_when_not_a_direct_title_match() + { + _xemSeries.Title = "Sonarr's Title"; + _xemSeries.CleanTitle = "sonarrstitle"; + + WithEpisode(1, 12, 2, 3); + + Mocker.GetMock() + .Setup(s => s.FindByTvdbId(It.IsAny())) + .Returns(new List + { + new SceneMapping + { + TvdbId = _xemSeries.TvdbId, + SearchTerm = "Sonarrs Title", + ParseTerm = _xemSeries.CleanTitle, + SeasonNumber = 1, + SceneSeasonNumber = 1, + SceneOrigin = "tvdb", + Type = "ServicesProvider" + } + }); + + var allCriteria = WatchForSearchCriteria(); + + await Subject.EpisodeSearch(_xemEpisodes.First(), false, false); + + Mocker.GetMock() + .Verify(v => v.FindByTvdbId(_xemSeries.Id), Times.Once()); + + allCriteria.Should().HaveCount(2); + + allCriteria.First().Should().BeOfType(); + allCriteria.First().As().SeasonNumber.Should().Be(1); + allCriteria.First().As().EpisodeNumber.Should().Be(12); + + allCriteria.Last().Should().BeOfType(); + allCriteria.Last().As().SeasonNumber.Should().Be(2); + allCriteria.Last().As().EpisodeNumber.Should().Be(3); + } } } diff --git a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs index 51b0a75cf..ee892b7b9 100644 --- a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs @@ -265,7 +265,7 @@ private IEnumerable GetSceneEpisodeMappings(Series series, } } - if (sceneMapping.ParseTerm == series.CleanTitle && sceneMapping.FilterRegex.IsNullOrWhiteSpace()) + if (sceneMapping.SearchTerm == series.Title && sceneMapping.FilterRegex.IsNullOrWhiteSpace()) { // Disable the implied mapping if we have an explicit mapping by the same name includeGlobal = false;