1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-26 04:33:01 +01:00

Fixed: Include full series title in episode search

This commit is contained in:
Mark McDowall 2024-05-27 17:27:57 -07:00 committed by Mark McDowall
parent fd3dd1ab7d
commit 9c1f48ebc9
2 changed files with 43 additions and 1 deletions

View File

@ -608,5 +608,47 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
allCriteria.Last().As<SingleEpisodeSearchCriteria>().SeasonNumber.Should().Be(2); allCriteria.Last().As<SingleEpisodeSearchCriteria>().SeasonNumber.Should().Be(2);
allCriteria.Last().As<SingleEpisodeSearchCriteria>().EpisodeNumber.Should().Be(3); allCriteria.Last().As<SingleEpisodeSearchCriteria>().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<ISceneMappingService>()
.Setup(s => s.FindByTvdbId(It.IsAny<int>()))
.Returns(new List<SceneMapping>
{
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<ISceneMappingService>()
.Verify(v => v.FindByTvdbId(_xemSeries.Id), Times.Once());
allCriteria.Should().HaveCount(2);
allCriteria.First().Should().BeOfType<SingleEpisodeSearchCriteria>();
allCriteria.First().As<SingleEpisodeSearchCriteria>().SeasonNumber.Should().Be(1);
allCriteria.First().As<SingleEpisodeSearchCriteria>().EpisodeNumber.Should().Be(12);
allCriteria.Last().Should().BeOfType<SingleEpisodeSearchCriteria>();
allCriteria.Last().As<SingleEpisodeSearchCriteria>().SeasonNumber.Should().Be(2);
allCriteria.Last().As<SingleEpisodeSearchCriteria>().EpisodeNumber.Should().Be(3);
}
} }
} }

View File

@ -265,7 +265,7 @@ namespace NzbDrone.Core.IndexerSearch
} }
} }
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 // Disable the implied mapping if we have an explicit mapping by the same name
includeGlobal = false; includeGlobal = false;