1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Fixed: Don't grab propers/repacks when item in queue meets cutoff and propers/repacks are not downloaded automatically

Fixes #8134
This commit is contained in:
Qstick 2023-04-13 18:47:21 -05:00
parent 323510300c
commit 3d244057b5
2 changed files with 42 additions and 0 deletions

View File

@ -4,9 +4,11 @@
using FluentAssertions; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFormats; using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.DecisionEngine.Specifications; using NzbDrone.Core.DecisionEngine.Specifications;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles; using NzbDrone.Core.Profiles;
@ -204,5 +206,31 @@ public void should_return_true_if_everything_is_the_same_for_failed_pending()
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue(); Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
} }
[Test]
public void should_return_false_if_same_quality_non_proper_in_queue_and_download_propers_is_do_not_upgrade()
{
_remoteMovie.ParsedMovieInfo.Quality = new QualityModel(Quality.HDTV720p, new Revision(2));
_movie.Profile.Cutoff = _remoteMovie.ParsedMovieInfo.Quality.Quality.Id;
Mocker.GetMock<IConfigService>()
.Setup(s => s.DownloadPropersAndRepacks)
.Returns(ProperDownloadTypes.DoNotUpgrade);
var remoteMovie = Builder<RemoteMovie>.CreateNew()
.With(r => r.Movie = _movie)
.With(r => r.ParsedMovieInfo = new ParsedMovieInfo
{
Quality = new QualityModel(Quality.HDTV720p),
Languages = new List<Language> { Language.English }
})
.With(r => r.Release = _releaseInfo)
.With(r => r.CustomFormats = new List<CustomFormat>())
.Build();
GivenQueue(new List<RemoteMovie> { remoteMovie });
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
}
} }
} }

View File

@ -1,10 +1,12 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.CustomFormats; using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Queue; using NzbDrone.Core.Queue;
namespace NzbDrone.Core.DecisionEngine.Specifications namespace NzbDrone.Core.DecisionEngine.Specifications
@ -14,16 +16,19 @@ public class QueueSpecification : IDecisionEngineSpecification
private readonly IQueueService _queueService; private readonly IQueueService _queueService;
private readonly UpgradableSpecification _upgradableSpecification; private readonly UpgradableSpecification _upgradableSpecification;
private readonly ICustomFormatCalculationService _formatService; private readonly ICustomFormatCalculationService _formatService;
private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public QueueSpecification(IQueueService queueService, public QueueSpecification(IQueueService queueService,
UpgradableSpecification upgradableSpecification, UpgradableSpecification upgradableSpecification,
ICustomFormatCalculationService formatService, ICustomFormatCalculationService formatService,
IConfigService configService,
Logger logger) Logger logger)
{ {
_queueService = queueService; _queueService = queueService;
_upgradableSpecification = upgradableSpecification; _upgradableSpecification = upgradableSpecification;
_formatService = formatService; _formatService = formatService;
_configService = configService;
_logger = logger; _logger = logger;
} }
@ -85,6 +90,15 @@ public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCrit
{ {
return Decision.Reject("Another release is queued and the Quality profile does not allow upgrades"); return Decision.Reject("Another release is queued and the Quality profile does not allow upgrades");
} }
if (_upgradableSpecification.IsRevisionUpgrade(remoteMovie.ParsedMovieInfo.Quality, subject.ParsedMovieInfo.Quality))
{
if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotUpgrade)
{
_logger.Debug("Auto downloading of propers is disabled");
return Decision.Reject("Proper downloading is disabled");
}
}
} }
return Decision.Accept(); return Decision.Accept();