Fixed: Searching for series with XEM and TVDB mapping overrides

This commit is contained in:
Mark McDowall 2023-10-28 15:31:17 -07:00
parent aa8659eecd
commit 58d841c463
2 changed files with 41 additions and 1 deletions

View File

@ -568,5 +568,45 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
allCriteria.First().Should().BeOfType<SeasonSearchCriteria>();
allCriteria.First().As<SeasonSearchCriteria>().SeasonNumber.Should().Be(7);
}
[Test]
public async Task episode_search_should_use_all_available_numbering_from_services_and_xem()
{
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 = _xemSeries.Title,
ParseTerm = _xemSeries.Title,
FilterRegex = "(?i)-(BTN)$",
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.IsNotNullOrWhiteSpace())
if (sceneMapping.ParseTerm == series.CleanTitle && sceneMapping.FilterRegex.IsNullOrWhiteSpace())
{
// Disable the implied mapping if we have an explicit mapping by the same name
includeGlobal = false;