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