From 7066b078ab2ac10f6c063c945df9da8647448bb7 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Mon, 10 Apr 2017 11:17:31 +0200 Subject: [PATCH] Allow Hardcoded subs to be downloaded still. --- .../Config/IndexerConfigResource.cs | 2 ++ .../Configuration/ConfigService.cs | 7 ++++++ .../Configuration/IConfigService.cs | 2 ++ .../DecisionEngine/DownloadDecisionMaker.cs | 14 ++++++++++-- .../Options/IndexerOptionsViewTemplate.hbs | 22 +++++++++++++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Api/Config/IndexerConfigResource.cs b/src/NzbDrone.Api/Config/IndexerConfigResource.cs index 0faacfccc..3bd091aa6 100644 --- a/src/NzbDrone.Api/Config/IndexerConfigResource.cs +++ b/src/NzbDrone.Api/Config/IndexerConfigResource.cs @@ -9,6 +9,7 @@ namespace NzbDrone.Api.Config public int Retention { get; set; } public int RssSyncInterval { get; set; } public int AvailabilityDelay { get; set; } + public bool AllowHardcodedSubs { get; set; } } public static class IndexerConfigResourceMapper @@ -21,6 +22,7 @@ namespace NzbDrone.Api.Config Retention = model.Retention, RssSyncInterval = model.RssSyncInterval, AvailabilityDelay = model.AvailabilityDelay, + AllowHardcodedSubs = model.AllowHardcodedSubs, }; } } diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index 094a0fbc3..78dcbc8ea 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -190,6 +190,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("EnableCompletedDownloadHandling", value); } } + public bool AllowHardcodedSubs + { + get { return GetValueBoolean("AllowHardcodedSubs", false); } + + set { SetValue("AllowHardcodedSubs", value); } + } + public bool RemoveCompletedDownloads { get { return GetValueBoolean("RemoveCompletedDownloads", false); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index 7707e5a01..e6687bf68 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -48,6 +48,8 @@ namespace NzbDrone.Core.Configuration int AvailabilityDelay { get; set; } + bool AllowHardcodedSubs { get; set; } + int NetImportSyncInterval { get; set; } string ListSyncLevel { get; set; } string ImportExclusions { get; set; } diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index a43b408b9..0a1a18bc4 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -5,6 +5,7 @@ using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Common.Instrumentation.Extensions; using NzbDrone.Common.Serializer; +using NzbDrone.Core.Configuration; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Parser; using NzbDrone.Core.Parser.Model; @@ -21,12 +22,14 @@ namespace NzbDrone.Core.DecisionEngine { private readonly IEnumerable _specifications; private readonly IParsingService _parsingService; + private readonly IConfigService _configService; private readonly Logger _logger; - public DownloadDecisionMaker(IEnumerable specifications, IParsingService parsingService, Logger logger) + public DownloadDecisionMaker(IEnumerable specifications, IParsingService parsingService, IConfigService configService, Logger logger) { _specifications = specifications; _parsingService = parsingService; + _configService = configService; _logger = logger; } @@ -82,7 +85,14 @@ namespace NzbDrone.Core.DecisionEngine if (parsedMovieInfo.Quality.HardcodedSubs.IsNotNullOrWhiteSpace()) { remoteMovie.DownloadAllowed = true; - decision = new DownloadDecision(remoteMovie, new Rejection("Hardcoded subs found: " + parsedMovieInfo.Quality.HardcodedSubs)); + if (_configService.AllowHardcodedSubs) + { + decision = GetDecisionForReport(remoteMovie, searchCriteria); + } + else + { + decision = new DownloadDecision(remoteMovie, new Rejection("Hardcoded subs found: " + parsedMovieInfo.Quality.HardcodedSubs)); + } } else { diff --git a/src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.hbs b/src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.hbs index c194c1bfc..0b2408e15 100644 --- a/src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.hbs +++ b/src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.hbs @@ -37,6 +37,28 @@ + +
+ +
+ +
+
+
+
+ +
+ Availability Options