public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria) { _logger.Trace("Beginning size check for: {0}", subject); var quality = subject.ParsedEpisodeInfo.Quality.Quality; if (quality == Quality.RAWHD) { _logger.Trace("Raw-HD release found, skipping size check."); return(true); } if (quality == Quality.Unknown) { _logger.Trace("Unknown quality. skipping size check."); return(false); } var qualityType = _qualityTypeProvider.Get(quality.Id); if (qualityType.MaxSize == 0) { _logger.Trace("Max size is 0 (unlimited) - skipping check."); return(true); } var maxSize = qualityType.MaxSize.Megabytes(); //Multiply maxSize by Series.Runtime maxSize = maxSize * subject.Series.Runtime * subject.Episodes.Count; //Check if there was only one episode parsed and it is the first if (subject.Episodes.Count == 1 && subject.Episodes.First().EpisodeNumber == 1) { maxSize = maxSize * 2; } //If the parsed size is greater than maxSize we don't want it if (subject.Release.Size > maxSize) { _logger.Trace("Item: {0}, Size: {1} is greater than maximum allowed size ({2}), rejecting.", subject, subject.Release.Size, maxSize); return(false); } _logger.Trace("Item: {0}, meets size constraints.", subject); return(true); }
private QualitySizeResource GetById(int id) { return(_qualityTypeProvider.Get(id).InjectTo <QualitySizeResource>()); }