You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.DecisionEngine
|
|
|
|
{
|
|
|
|
public class DownloadDecision
|
|
|
|
{
|
|
|
|
public RemoteEpisode RemoteEpisode { get; private set; }
|
|
|
|
public IEnumerable<Rejection> Rejections { get; private set; }
|
|
|
|
|
|
|
|
public bool Approved
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return !Rejections.Any();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool TemporarilyRejected
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return Rejections.Any() && Rejections.All(r => r.Type == RejectionType.Temporary);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Rejected
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return Rejections.Any() && Rejections.Any(r => r.Type == RejectionType.Permanent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public DownloadDecision(RemoteEpisode episode, params Rejection[] rejections)
|
|
|
|
{
|
|
|
|
RemoteEpisode = episode;
|
|
|
|
Rejections = rejections.ToList();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
if (Approved)
|
|
|
|
{
|
|
|
|
return "[OK] " + RemoteEpisode;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "[Rejected " + Rejections.Count() + "]" + RemoteEpisode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|