mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
some preliminary work to move decision engine to use the visitor pattern.
This commit is contained in:
parent
969dff5197
commit
02d842a2b2
51 changed files with 470 additions and 507 deletions
|
@ -0,0 +1,35 @@
|
|||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications
|
||||
{
|
||||
public class LanguageSpecification : IFetchableSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public LanguageSpecification(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Not English";
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
||||
{
|
||||
_logger.Trace("Checking if report meets language requirements. {0}", subject.Language);
|
||||
if (subject.Language != LanguageType.English)
|
||||
{
|
||||
_logger.Trace("Report Language: {0} rejected because it is not English", subject.Language);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue