Delay Profile: Delay for at least 1 preferred word

This commit is contained in:
vertigo235 2017-02-04 02:26:11 -05:00
parent b6235e99c8
commit 0d647ffb9a
1 changed files with 6 additions and 3 deletions

View File

@ -68,11 +68,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
// If quality meets or exceeds the best allowed quality in the profile accept it immediately
var bestQualityInProfile = new QualityModel(profile.LastAllowedQuality());
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality, bestQualityInProfile) >= 0;
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality, bestQualityInProfile) >= 0;
var title = subject.Release.Title;
var preferredWords = subject.Movie.Profile.Value.PreferredTags;
var num = preferredWords.AsEnumerable().Count(w => title.ToLower().Contains(w.ToLower()));
if (isBestInProfile && isPreferredProtocol)
if (isBestInProfile && isPreferredProtocol && (num > 0 || preferredWords == null))
{
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay");
_logger.Debug("Quality is highest in profile for preferred protocol and preferred word count is {0}, will not delay",num);
return Decision.Accept();
}