|
|
@ -1,9 +1,11 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -11,12 +13,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IMediaFileService _mediaFileService;
|
|
|
|
private readonly IMediaFileService _mediaFileService;
|
|
|
|
private readonly UpgradableSpecification _upgradableSpecification;
|
|
|
|
private readonly UpgradableSpecification _upgradableSpecification;
|
|
|
|
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public RepackSpecification(IMediaFileService mediaFileService, UpgradableSpecification upgradableSpecification, Logger logger)
|
|
|
|
public RepackSpecification(IMediaFileService mediaFileService, UpgradableSpecification upgradableSpecification, IConfigService configService, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_mediaFileService = mediaFileService;
|
|
|
|
_mediaFileService = mediaFileService;
|
|
|
|
_upgradableSpecification = upgradableSpecification;
|
|
|
|
_upgradableSpecification = upgradableSpecification;
|
|
|
|
|
|
|
|
_configService = configService;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +34,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
return Decision.Accept();
|
|
|
|
return Decision.Accept();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (downloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Debug("Repacks are not preferred, skipping check");
|
|
|
|
|
|
|
|
return Decision.Accept();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var book in subject.Books)
|
|
|
|
foreach (var book in subject.Books)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var releaseGroup = subject.ParsedBookInfo.ReleaseGroup;
|
|
|
|
var releaseGroup = subject.ParsedBookInfo.ReleaseGroup;
|
|
|
@ -39,6 +51,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_upgradableSpecification.IsRevisionUpgrade(file.Quality, subject.ParsedBookInfo.Quality))
|
|
|
|
if (_upgradableSpecification.IsRevisionUpgrade(file.Quality, subject.ParsedBookInfo.Quality))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (downloadPropersAndRepacks == ProperDownloadTypes.DoNotUpgrade)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Debug("Auto downloading of repacks is disabled");
|
|
|
|
|
|
|
|
return Decision.Reject("Repack downloading is disabled");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var fileReleaseGroup = file.ReleaseGroup;
|
|
|
|
var fileReleaseGroup = file.ReleaseGroup;
|
|
|
|
|
|
|
|
|
|
|
|
if (fileReleaseGroup.IsNullOrWhiteSpace())
|
|
|
|
if (fileReleaseGroup.IsNullOrWhiteSpace())
|
|
|
|