Fixed: Only match via TV Rage ID if TheTVDB ID is not available

Closes #6517
This commit is contained in:
Mark McDowall 2024-02-17 21:59:23 -08:00 committed by Mark McDowall
parent 43797b326d
commit a7607ac7d6
2 changed files with 14 additions and 3 deletions

View File

@ -191,12 +191,23 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
{ {
GivenParseResultSeriesDoesntMatchSearchCriteria(); GivenParseResultSeriesDoesntMatchSearchCriteria();
Subject.Map(_parsedEpisodeInfo, 10, 10, _singleEpisodeSearchCriteria); Subject.Map(_parsedEpisodeInfo, 0, 10, _singleEpisodeSearchCriteria);
Mocker.GetMock<ISeriesService>() Mocker.GetMock<ISeriesService>()
.Verify(v => v.FindByTvRageId(It.IsAny<int>()), Times.Once()); .Verify(v => v.FindByTvRageId(It.IsAny<int>()), Times.Once());
} }
[Test]
public void should_not_FindByTvRageId_when_search_criteria_and_FindByTitle_matching_fails_and_tvdb_id_is_specified()
{
GivenParseResultSeriesDoesntMatchSearchCriteria();
Subject.Map(_parsedEpisodeInfo, 10, 10, _singleEpisodeSearchCriteria);
Mocker.GetMock<ISeriesService>()
.Verify(v => v.FindByTvRageId(It.IsAny<int>()), Times.Never());
}
[Test] [Test]
public void should_use_tvdbid_matching_when_alias_is_found() public void should_use_tvdbid_matching_when_alias_is_found()
{ {

View File

@ -396,7 +396,7 @@ namespace NzbDrone.Core.Parser
return new FindSeriesResult(searchCriteria.Series, SeriesMatchType.Id); return new FindSeriesResult(searchCriteria.Series, SeriesMatchType.Id);
} }
if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId) if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId && tvdbId <= 0)
{ {
_logger.Debug() _logger.Debug()
.Message("Found matching series by TVRage ID {0}, an alias may be needed for: {1}", tvRageId, parsedEpisodeInfo.SeriesTitle) .Message("Found matching series by TVRage ID {0}, an alias may be needed for: {1}", tvRageId, parsedEpisodeInfo.SeriesTitle)
@ -446,7 +446,7 @@ namespace NzbDrone.Core.Parser
} }
} }
if (series == null && tvRageId > 0) if (series == null && tvRageId > 0 && tvdbId <= 0)
{ {
series = _seriesService.FindByTvRageId(tvRageId); series = _seriesService.FindByTvRageId(tvRageId);