New: Log conflicting TVDB ID when unknown series is an alias for another series

This commit is contained in:
Mark McDowall 2019-03-05 00:30:37 -08:00
parent 4f1f56f653
commit 269a5bd914
2 changed files with 31 additions and 1 deletions

View File

@ -11,6 +11,7 @@ using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using FizzWare.NBuilder;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.DecisionEngine.Specifications;
namespace NzbDrone.Core.Test.DecisionEngineTests
@ -315,5 +316,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
ExceptionVerification.ExpectedErrors(1);
}
[Test]
public void should_return_unknown_series_rejection_if_series_title_is_an_alias_for_another_series()
{
GivenSpecifications(_pass1, _pass2, _pass3);
Mocker.GetMock<ISceneMappingService>()
.Setup(s => s.FindTvdbId(It.IsAny<string>(), It.IsAny<string>()))
.Returns(12345);
_remoteEpisode.Series = null;
var result = Subject.GetRssDecision(_reports);
result.Should().HaveCount(1);
result.First().Rejections.First().Reason.Should().Contain("12345");
}
}
}

View File

@ -5,6 +5,7 @@ using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Download.Aggregation;
using NzbDrone.Core.IndexerSearch.Definitions;
@ -24,16 +25,19 @@ namespace NzbDrone.Core.DecisionEngine
private readonly IEnumerable<IDecisionEngineSpecification> _specifications;
private readonly IParsingService _parsingService;
private readonly IRemoteEpisodeAggregationService _aggregationService;
private readonly ISceneMappingService _sceneMappingService;
private readonly Logger _logger;
public DownloadDecisionMaker(IEnumerable<IDecisionEngineSpecification> specifications,
IParsingService parsingService,
IRemoteEpisodeAggregationService aggregationService,
ISceneMappingService sceneMappingService,
Logger logger)
{
_specifications = specifications;
_parsingService = parsingService;
_aggregationService = aggregationService;
_sceneMappingService = sceneMappingService;
_logger = logger;
}
@ -88,7 +92,15 @@ namespace NzbDrone.Core.DecisionEngine
if (remoteEpisode.Series == null)
{
decision = new DownloadDecision(remoteEpisode, new Rejection("Unknown Series"));
var reason = "Unknown Series";
var matchingTvdbId = _sceneMappingService.FindTvdbId(parsedEpisodeInfo.SeriesTitle, parsedEpisodeInfo.ReleaseTitle);
if (matchingTvdbId.HasValue)
{
reason = $"{parsedEpisodeInfo.SeriesTitle} matches an alias for series with TVDB ID: {matchingTvdbId}";
}
decision = new DownloadDecision(remoteEpisode, new Rejection(reason));
}
else if (remoteEpisode.Episodes.Empty())
{