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