2013-03-07 01:19:49 +01:00
|
|
|
using NLog;
|
2013-04-15 03:41:39 +02:00
|
|
|
using NzbDrone.Core.Parser;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
2013-03-07 01:19:49 +01:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
2013-04-07 09:30:37 +02:00
|
|
|
public class LanguageSpecification : IDecisionEngineSpecification
|
2013-03-07 01:19:49 +01:00
|
|
|
{
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
public LanguageSpecification(Logger logger)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string RejectionReason
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return "Not English";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 03:41:39 +02:00
|
|
|
public virtual bool IsSatisfiedBy(RemoteEpisode subject)
|
2013-03-07 01:19:49 +01:00
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
_logger.Trace("Checking if report meets language requirements. {0}", subject.ParsedEpisodeInfo.Language);
|
|
|
|
if (subject.ParsedEpisodeInfo.Language != Language.English)
|
2013-03-07 01:19:49 +01:00
|
|
|
{
|
2013-04-28 21:46:13 +02:00
|
|
|
_logger.Trace("Report Language: {0} rejected because it is not English", subject.ParsedEpisodeInfo.Language);
|
2013-03-07 01:19:49 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|