mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
rewrite of indexer/episode search
This commit is contained in:
parent
9ae21cf7a1
commit
a6a4932b44
114 changed files with 2045 additions and 5577 deletions
|
@ -1,11 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public class DownloadDecision
|
||||
{
|
||||
public EpisodeParseResult ParseResult { get; private set; }
|
||||
public IEnumerable<string> Rejections { get; private set; }
|
||||
|
||||
public bool Approved
|
||||
{
|
||||
get
|
||||
|
@ -14,9 +17,23 @@ namespace NzbDrone.Core.DecisionEngine
|
|||
}
|
||||
}
|
||||
|
||||
public DownloadDecision(params string[] rejections)
|
||||
public DownloadDecision(EpisodeParseResult parseResult, params string[] rejections)
|
||||
{
|
||||
ParseResult = parseResult;
|
||||
Rejections = rejections.ToList();
|
||||
}
|
||||
|
||||
|
||||
public static EpisodeParseResult PickBestReport(IEnumerable<DownloadDecision> downloadDecisions)
|
||||
{
|
||||
var reports = downloadDecisions
|
||||
.Where(c => c.Approved)
|
||||
.Select(c => c.ParseResult)
|
||||
.OrderByDescending(c => c.Quality)
|
||||
.ThenBy(c => c.EpisodeNumbers.MinOrDefault())
|
||||
.ThenBy(c => c.Age);
|
||||
|
||||
return reports.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue