1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-06 11:02:40 +01:00
Radarr/NzbDrone.Core/Providers/DecisionEngine/CustomStartDateSpecification.cs

31 lines
956 B
C#
Raw Normal View History

2012-09-19 03:30:30 +02:00
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Providers.DecisionEngine
{
2012-09-20 17:37:40 +02:00
public class CustomStartDateSpecification
2012-09-19 03:30:30 +02:00
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
{
2012-09-20 17:37:40 +02:00
if (!subject.Series.CustomStartDate.HasValue)
2012-09-19 03:30:30 +02:00
{
logger.Debug("{0} does not restrict downloads before date.", subject.Series.Title);
return true;
}
2012-10-21 02:19:30 +02:00
if (subject.Episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value))
2012-09-19 03:30:30 +02:00
{
logger.Debug("One or more episodes aired after cutoff, downloading.");
return true;
}
2012-09-20 17:37:40 +02:00
logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.CustomStartDate);
2012-09-19 03:30:30 +02:00
return false;
}
}
}