1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

New: Custom Format Language Condition

This commit is contained in:
Qstick
2022-08-14 14:07:26 -05:00
parent 52760e0908
commit 89b0b04e08
243 changed files with 1345 additions and 3956 deletions
@@ -2,7 +2,6 @@ using System.Linq;
using NLog;
using NzbDrone.Core.Download.Pending;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles.Delay;
using NzbDrone.Core.Qualities;
@@ -36,7 +35,6 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
}
var qualityProfile = subject.Series.QualityProfile.Value;
var languageProfile = subject.Series.LanguageProfile.Value;
var delayProfile = _delayProfileService.BestForTags(subject.Series.Tags);
var delay = delayProfile.GetProtocolDelay(subject.Release.DownloadProtocol);
var isPreferredProtocol = subject.Release.DownloadProtocol == delayProfile.PreferredProtocol;
@@ -48,7 +46,6 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
}
var qualityComparer = new QualityModelComparer(qualityProfile);
var languageComparer = new LanguageComparer(languageProfile);
if (isPreferredProtocol)
{
@@ -71,11 +68,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
var bestQualityInProfile = qualityProfile.LastAllowedQuality();
var isBestInProfile = qualityComparer.Compare(subject.ParsedEpisodeInfo.Quality.Quality, bestQualityInProfile) >= 0;
var isBestInProfileLanguage = languageComparer.Compare(subject.ParsedEpisodeInfo.Language, languageProfile.LastAllowedLanguage()) >= 0;
if (isBestInProfile && isBestInProfileLanguage && isPreferredProtocol)
if (isBestInProfile && isPreferredProtocol)
{
_logger.Debug("Quality and language is highest in profile for preferred protocol, will not delay");
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay");
return Decision.Accept();
}
}
@@ -65,20 +65,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
// Instead of fetching the series from the DB reuse the known series.
var cutoffUnmet = _upgradableSpecification.CutoffNotMet(
subject.Series.QualityProfile,
subject.Series.LanguageProfile,
mostRecent.Quality,
mostRecent.Language,
customFormats,
subject.ParsedEpisodeInfo.Quality);
var upgradeable = _upgradableSpecification.IsUpgradable(
subject.Series.QualityProfile,
subject.Series.LanguageProfile,
mostRecent.Quality,
mostRecent.Language,
customFormats,
subject.ParsedEpisodeInfo.Quality,
subject.ParsedEpisodeInfo.Language,
subject.CustomFormats);
if (!cutoffUnmet)