|
|
@ -1,19 +1,23 @@
|
|
|
|
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.Parser.Model;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class RepackSpecification : IDecisionEngineSpecification
|
|
|
|
public class RepackSpecification : IDecisionEngineSpecification
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly UpgradableSpecification _upgradableSpecification;
|
|
|
|
private readonly UpgradableSpecification _upgradableSpecification;
|
|
|
|
|
|
|
|
private readonly IConfigService _configService;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public RepackSpecification(UpgradableSpecification upgradableSpecification, Logger logger)
|
|
|
|
public RepackSpecification(UpgradableSpecification upgradableSpecification, IConfigService configService, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_upgradableSpecification = upgradableSpecification;
|
|
|
|
_upgradableSpecification = upgradableSpecification;
|
|
|
|
|
|
|
|
_configService = configService;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -22,11 +26,19 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
|
|
|
|
|
|
|
|
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
|
|
|
public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCriteria)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
|
|
|
|
|
|
|
|
|
|
|
|
if (!subject.ParsedMovieInfo.Quality.Revision.IsRepack)
|
|
|
|
if (!subject.ParsedMovieInfo.Quality.Revision.IsRepack)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Decision.Accept();
|
|
|
|
return Decision.Accept();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (downloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Debug("Repacks are not preferred, skipping check");
|
|
|
|
|
|
|
|
return Decision.Accept();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (subject.Movie.MovieFileId != 0)
|
|
|
|
if (subject.Movie.MovieFileId != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var file = subject.Movie.MovieFile;
|
|
|
|
var file = subject.Movie.MovieFile;
|
|
|
@ -36,6 +48,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
var releaseGroup = subject.ParsedMovieInfo.ReleaseGroup;
|
|
|
|
var releaseGroup = subject.ParsedMovieInfo.ReleaseGroup;
|
|
|
|
var fileReleaseGroup = file.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())
|
|
|
|
if (fileReleaseGroup.IsNullOrWhiteSpace())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Decision.Reject("Unable to determine release group for the existing file");
|
|
|
|
return Decision.Reject("Unable to determine release group for the existing file");
|
|
|
|