mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Moved DecisionEngine to root of core.
This commit is contained in:
parent
324b5e3b80
commit
499401fc70
39 changed files with 78 additions and 79 deletions
29
NzbDrone.Core/DecisionEngine/CustomStartDateSpecification.cs
Normal file
29
NzbDrone.Core/DecisionEngine/CustomStartDateSpecification.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public class CustomStartDateSpecification
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
||||
{
|
||||
if (!subject.Series.CustomStartDate.HasValue)
|
||||
{
|
||||
logger.Debug("{0} does not restrict downloads before date.", subject.Series.Title);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subject.Episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value))
|
||||
{
|
||||
logger.Debug("One or more episodes aired after cutoff, downloading.");
|
||||
return true;
|
||||
}
|
||||
|
||||
logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.CustomStartDate);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue