mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-27 23:06:29 -04:00
New: Don't block imports when release was matched by ID if they were grabbed via interactive search
Closes #5043
This commit is contained in:
committed by
Mark McDowall
parent
599ad86657
commit
bc2942c28d
@@ -17,7 +17,7 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public interface IMakeDownloadDecision
|
||||
{
|
||||
List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports);
|
||||
List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports, bool pushedRelease = false);
|
||||
List<DownloadDecision> GetSearchDecision(List<ReleaseInfo> reports, SearchCriteriaBase searchCriteriaBase);
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports)
|
||||
public List<DownloadDecision> GetRssDecision(List<ReleaseInfo> reports, bool pushedRelease = false)
|
||||
{
|
||||
return GetDecisions(reports).ToList();
|
||||
}
|
||||
|
||||
public List<DownloadDecision> GetSearchDecision(List<ReleaseInfo> reports, SearchCriteriaBase searchCriteriaBase)
|
||||
{
|
||||
return GetDecisions(reports, searchCriteriaBase).ToList();
|
||||
return GetDecisions(reports, false, searchCriteriaBase).ToList();
|
||||
}
|
||||
|
||||
private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, SearchCriteriaBase searchCriteria = null)
|
||||
private IEnumerable<DownloadDecision> GetDecisions(List<ReleaseInfo> reports, bool pushedRelease = false, SearchCriteriaBase searchCriteria = null)
|
||||
{
|
||||
if (reports.Any())
|
||||
{
|
||||
@@ -156,6 +156,26 @@ namespace NzbDrone.Core.DecisionEngine
|
||||
|
||||
if (decision != null)
|
||||
{
|
||||
var source = pushedRelease ? ReleaseSourceType.ReleasePush : ReleaseSourceType.Rss;
|
||||
|
||||
if (searchCriteria != null)
|
||||
{
|
||||
if (searchCriteria.InteractiveSearch)
|
||||
{
|
||||
source = ReleaseSourceType.InteractiveSearch;
|
||||
}
|
||||
else if (searchCriteria.UserInvokedSearch)
|
||||
{
|
||||
source = ReleaseSourceType.UserInvokedSearch;
|
||||
}
|
||||
else
|
||||
{
|
||||
source = ReleaseSourceType.Search;
|
||||
}
|
||||
}
|
||||
|
||||
decision.RemoteEpisode.ReleaseSource = source;
|
||||
|
||||
if (decision.Rejections.Any())
|
||||
{
|
||||
_logger.Debug("Release rejected for the following reasons: {0}", string.Join(", ", decision.Rejections));
|
||||
|
||||
+71
-73
@@ -1,73 +1,71 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.DataAugmentation.Scene;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
{
|
||||
public class SceneMappingSpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public SceneMappingSpecification(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public SpecificationPriority Priority => SpecificationPriority.Default;
|
||||
public RejectionType Type => RejectionType.Temporary; // Temporary till there's a mapping
|
||||
|
||||
public Decision IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (remoteEpisode.SceneMapping == null)
|
||||
{
|
||||
_logger.Debug("No applicable scene mapping, skipping.");
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
if (remoteEpisode.SceneMapping.SceneOrigin.IsNullOrWhiteSpace())
|
||||
{
|
||||
_logger.Debug("No explicit scene origin in scene mapping.");
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
var split = remoteEpisode.SceneMapping.SceneOrigin.Split(':');
|
||||
|
||||
var isInteractive = searchCriteria != null && searchCriteria.InteractiveSearch;
|
||||
|
||||
if (remoteEpisode.SceneMapping.Comment.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
_logger.Debug("SceneMapping has origin {0} with comment '{1}'.", remoteEpisode.SceneMapping.SceneOrigin, remoteEpisode.SceneMapping.Comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("SceneMapping has origin {0}.", remoteEpisode.SceneMapping.SceneOrigin);
|
||||
}
|
||||
|
||||
if (split[0] == "mixed")
|
||||
{
|
||||
_logger.Debug("SceneMapping origin is explicitly mixed, this means these were released with multiple unidentifiable numbering schemes.");
|
||||
|
||||
if (remoteEpisode.SceneMapping.Comment.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return Decision.Reject("{0} has ambiguous numbering");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Decision.Reject("Ambiguous numbering");
|
||||
}
|
||||
}
|
||||
|
||||
if (split[0] == "unknown")
|
||||
{
|
||||
var type = split.Length >= 2 ? split[1] : "scene";
|
||||
|
||||
_logger.Debug("SceneMapping origin is explicitly unknown, unsure what numbering scheme it uses but '{0}' will be assumed. Provide full release title to Sonarr/TheXEM team.", type);
|
||||
}
|
||||
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
{
|
||||
public class SceneMappingSpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public SceneMappingSpecification(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public SpecificationPriority Priority => SpecificationPriority.Default;
|
||||
public RejectionType Type => RejectionType.Temporary; // Temporary till there's a mapping
|
||||
|
||||
public Decision IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (remoteEpisode.SceneMapping == null)
|
||||
{
|
||||
_logger.Debug("No applicable scene mapping, skipping.");
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
if (remoteEpisode.SceneMapping.SceneOrigin.IsNullOrWhiteSpace())
|
||||
{
|
||||
_logger.Debug("No explicit scene origin in scene mapping.");
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
||||
var split = remoteEpisode.SceneMapping.SceneOrigin.Split(':');
|
||||
|
||||
var isInteractive = searchCriteria != null && searchCriteria.InteractiveSearch;
|
||||
|
||||
if (remoteEpisode.SceneMapping.Comment.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
_logger.Debug("SceneMapping has origin {0} with comment '{1}'.", remoteEpisode.SceneMapping.SceneOrigin, remoteEpisode.SceneMapping.Comment);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("SceneMapping has origin {0}.", remoteEpisode.SceneMapping.SceneOrigin);
|
||||
}
|
||||
|
||||
if (split[0] == "mixed")
|
||||
{
|
||||
_logger.Debug("SceneMapping origin is explicitly mixed, this means these were released with multiple unidentifiable numbering schemes.");
|
||||
|
||||
if (remoteEpisode.SceneMapping.Comment.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
return Decision.Reject("{0} has ambiguous numbering");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Decision.Reject("Ambiguous numbering");
|
||||
}
|
||||
}
|
||||
|
||||
if (split[0] == "unknown")
|
||||
{
|
||||
var type = split.Length >= 2 ? split[1] : "scene";
|
||||
|
||||
_logger.Debug("SceneMapping origin is explicitly unknown, unsure what numbering scheme it uses but '{0}' will be assumed. Provide full release title to Sonarr/TheXEM team.", type);
|
||||
}
|
||||
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user