1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00

Fixed: Repack Preference Ignored

(cherry picked from commit 04447d9d4db8cc3d54baf0a721f4430cf77908c4)

Fixes #6595
Closes #7621
This commit is contained in:
bakerboy448
2022-09-22 11:49:19 -05:00
committed by Qstick
parent 9f3eecb2a9
commit b9886cd11c
2 changed files with 98 additions and 3 deletions
@@ -1,19 +1,23 @@
using System;
using System;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
public class RepackSpecification : IDecisionEngineSpecification
{
private readonly UpgradableSpecification _upgradableSpecification;
private readonly IConfigService _configService;
private readonly Logger _logger;
public RepackSpecification(UpgradableSpecification upgradableSpecification, Logger logger)
public RepackSpecification(UpgradableSpecification upgradableSpecification, IConfigService configService, Logger logger)
{
_upgradableSpecification = upgradableSpecification;
_configService = configService;
_logger = logger;
}
@@ -22,11 +26,19 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
{
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
if (!subject.ParsedMovieInfo.Quality.Revision.IsRepack)
{
return Decision.Accept();
}
if (downloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer)
{
_logger.Debug("Repacks are not preferred, skipping check");
return Decision.Accept();
}
if (subject.Movie.MovieFileId != 0)
{
var file = subject.Movie.MovieFile;
@@ -36,6 +48,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var releaseGroup = subject.ParsedMovieInfo.ReleaseGroup;
var fileReleaseGroup = file.ReleaseGroup;
if (downloadPropersAndRepacks == ProperDownloadTypes.DoNotUpgrade)
{
_logger.Debug("Auto downloading of repacks is disabled");
return Decision.Reject("Repack downloading is disabled");
}
if (fileReleaseGroup.IsNullOrWhiteSpace())
{
return Decision.Reject("Unable to determine release group for the existing file");