1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-28 02:37:40 +00:00
Sonarr/NzbDrone.Core/DecisionEngine/CustomStartDateSpecification.cs

30 lines
931 B
C#
Raw Normal View History

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