New: Log conflicting TVDB ID when unknown series is an alias for another series
This commit is contained in:
parent
4f1f56f653
commit
269a5bd914
|
@ -11,6 +11,7 @@ using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
|
using NzbDrone.Core.DataAugmentation.Scene;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
@ -315,5 +316,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||||
|
|
||||||
ExceptionVerification.ExpectedErrors(1);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Instrumentation.Extensions;
|
using NzbDrone.Common.Instrumentation.Extensions;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
using NzbDrone.Core.DataAugmentation.Scene;
|
||||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||||
using NzbDrone.Core.Download.Aggregation;
|
using NzbDrone.Core.Download.Aggregation;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
@ -24,16 +25,19 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
private readonly IEnumerable<IDecisionEngineSpecification> _specifications;
|
private readonly IEnumerable<IDecisionEngineSpecification> _specifications;
|
||||||
private readonly IParsingService _parsingService;
|
private readonly IParsingService _parsingService;
|
||||||
private readonly IRemoteEpisodeAggregationService _aggregationService;
|
private readonly IRemoteEpisodeAggregationService _aggregationService;
|
||||||
|
private readonly ISceneMappingService _sceneMappingService;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public DownloadDecisionMaker(IEnumerable<IDecisionEngineSpecification> specifications,
|
public DownloadDecisionMaker(IEnumerable<IDecisionEngineSpecification> specifications,
|
||||||
IParsingService parsingService,
|
IParsingService parsingService,
|
||||||
IRemoteEpisodeAggregationService aggregationService,
|
IRemoteEpisodeAggregationService aggregationService,
|
||||||
|
ISceneMappingService sceneMappingService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
_specifications = specifications;
|
_specifications = specifications;
|
||||||
_parsingService = parsingService;
|
_parsingService = parsingService;
|
||||||
_aggregationService = aggregationService;
|
_aggregationService = aggregationService;
|
||||||
|
_sceneMappingService = sceneMappingService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +92,15 @@ namespace NzbDrone.Core.DecisionEngine
|
||||||
|
|
||||||
if (remoteEpisode.Series == null)
|
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())
|
else if (remoteEpisode.Episodes.Empty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue