1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-10 21:12:56 +01:00
Radarr/NzbDrone.Core/Providers/DecisionEngine/CustomStartDateSpecification.cs
2012-10-20 17:19:30 -07:00

31 lines
956 B
C#

using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.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;
}
}
}