public virtual bool IsSatisfiedBy(EpisodeParseResult subject) { foreach (var episode in subject.Episodes) { var bestQualityInHistory = _historyProvider.GetBestQualityInHistory(subject.Series.SeriesId, episode.SeasonNumber, episode.EpisodeNumber); if (bestQualityInHistory != null) { logger.Trace("Comparing history quality with report. History is {0}", bestQualityInHistory); if (!_qualityUpgradeSpecification.IsSatisfiedBy(bestQualityInHistory, subject.Quality, subject.Series.QualityProfile.Cutoff)) { return(false); } } } return(true); }
public virtual bool IsSatisfiedBy(EpisodeParseResult subject) { foreach (var file in subject.Episodes.Select(c => c.EpisodeFile).Where(c => c != null)) { logger.Trace("Comparing file quality with report. Existing file is {0} proper:{1}", file.Quality, file.Proper); if (!_qualityUpgradeSpecification.IsSatisfiedBy(new QualityModel { Quality = file.Quality, Proper = file.Proper }, subject.Quality, subject.Series.QualityProfile.Cutoff)) { return(false); } if (subject.Quality.Proper && file.DateAdded < DateTime.Today.AddDays(-7)) { logger.Trace("Proper for old file, skipping: {0}", subject); return(false); } } return(true); }