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.
47 lines
1.5 KiB
47 lines
1.5 KiB
using System.Linq;
|
|
using NLog;
|
|
using NzbDrone.Common.Extensions;
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
{
|
|
public class RawDiskSpecification : IDecisionEngineSpecification
|
|
{
|
|
private static readonly string[] _dvdContainerTypes = new[] { "vob", "iso" };
|
|
|
|
private static readonly string[] _blurayContainerTypes = new[] { "m2ts" };
|
|
|
|
private readonly Logger _logger;
|
|
|
|
public RawDiskSpecification(Logger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public RejectionType Type { get { return RejectionType.Permanent; } }
|
|
|
|
public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
|
{
|
|
if (subject.Release == null || subject.Release.Container.IsNullOrWhiteSpace())
|
|
{
|
|
return Decision.Accept();
|
|
}
|
|
|
|
if (_dvdContainerTypes.Contains(subject.Release.Container.ToLower()))
|
|
{
|
|
_logger.Debug("Release contains raw DVD, rejecting.");
|
|
return Decision.Reject("Raw DVD release");
|
|
}
|
|
|
|
if (_blurayContainerTypes.Contains(subject.Release.Container.ToLower()))
|
|
{
|
|
_logger.Debug("Release contains raw Bluray, rejecting.");
|
|
return Decision.Reject("Raw Bluray release");
|
|
}
|
|
|
|
return Decision.Accept();
|
|
}
|
|
}
|
|
}
|