mirror of https://github.com/Radarr/Radarr
New: Don't block imports when release was matched by ID if they were grabbed via interactive search
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
ba7551ec65
commit
91f1fd9dd0
|
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
|||
|
||||
results.Should().NotBeEmpty();
|
||||
Mocker.GetMock<IMakeDownloadDecision>()
|
||||
.Verify(v => v.GetRssDecision(It.Is<List<ReleaseInfo>>(d => d.Count == 0)), Times.Never());
|
||||
.Verify(v => v.GetRssDecision(It.Is<List<ReleaseInfo>>(d => d.Count == 0), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
@ -136,6 +136,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.RemoteMovie.ReleaseSource = source;
|
||||
|
||||
if (decision.Rejections.Any())
|
||||
{
|
||||
_logger.Debug("Release '{0}' from '{1}' rejected for the following reasons: {2}", report.Title, report.Indexer, string.Join(", ", decision.Rejections));
|
||||
|
|
|
@ -99,8 +99,10 @@ namespace NzbDrone.Core.Download
|
|||
}
|
||||
|
||||
Enum.TryParse(historyItem.Data.GetValueOrDefault(MovieHistory.MOVIE_MATCH_TYPE, MovieMatchType.Unknown.ToString()), out MovieMatchType movieMatchType);
|
||||
Enum.TryParse(historyItem.Data.GetValueOrDefault(MovieHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
|
||||
|
||||
if (movieMatchType == MovieMatchType.Id)
|
||||
// Show a warning if the release was matched by ID and the source is not interactive search
|
||||
if (movieMatchType == MovieMatchType.Id && releaseSource != ReleaseSourceType.InteractiveSearch)
|
||||
{
|
||||
trackedDownload.Warn("Found matching movie via grab history, but release was matched to movie by ID. Manual Import required.");
|
||||
return;
|
||||
|
|
|
@ -21,5 +21,6 @@ namespace NzbDrone.Core.Download.Pending
|
|||
public class PendingReleaseAdditionalInfo
|
||||
{
|
||||
public MovieMatchType MovieMatchType { get; set; }
|
||||
public ReleaseSourceType ReleaseSource { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -294,6 +294,7 @@ namespace NzbDrone.Core.Download.Pending
|
|||
{
|
||||
Movie = movie,
|
||||
MovieMatchType = release.AdditionalInfo?.MovieMatchType ?? MovieMatchType.Unknown,
|
||||
ReleaseSource = release.AdditionalInfo?.ReleaseSource ?? ReleaseSourceType.Unknown,
|
||||
ParsedMovieInfo = release.ParsedMovieInfo,
|
||||
Release = release.Release
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace NzbDrone.Core.History
|
|||
{
|
||||
public const string DOWNLOAD_CLIENT = "downloadClient";
|
||||
public const string MOVIE_MATCH_TYPE = "movieMatchType";
|
||||
public const string RELEASE_SOURCE = "releaseSource";
|
||||
|
||||
public MovieHistory()
|
||||
{
|
||||
|
|
|
@ -154,6 +154,7 @@ namespace NzbDrone.Core.History
|
|||
history.Data.Add("Protocol", ((int)message.Movie.Release.DownloadProtocol).ToString());
|
||||
history.Data.Add("CustomFormatScore", message.Movie.CustomFormatScore.ToString());
|
||||
history.Data.Add("MovieMatchType", message.Movie.MovieMatchType.ToString());
|
||||
history.Data.Add("ReleaseSource", message.Movie.ReleaseSource.ToString());
|
||||
history.Data.Add("IndexerFlags", message.Movie.Release.IndexerFlags.ToString());
|
||||
history.Data.Add("IndexerId", message.Movie.Release.IndexerId.ToString());
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace NzbDrone.Core.Parser.Model
|
|||
public bool DownloadAllowed { get; set; }
|
||||
public TorrentSeedConfiguration SeedConfiguration { get; set; }
|
||||
public List<Language> Languages { get; set; }
|
||||
public ReleaseSourceType ReleaseSource { get; set; }
|
||||
|
||||
public RemoteMovie()
|
||||
{
|
||||
|
@ -29,4 +30,14 @@ namespace NzbDrone.Core.Parser.Model
|
|||
return Release.Title;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ReleaseSourceType
|
||||
{
|
||||
Unknown = 0,
|
||||
Rss = 1,
|
||||
Search = 2,
|
||||
UserInvokedSearch = 3,
|
||||
InteractiveSearch = 4,
|
||||
ReleasePush = 5
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue