Added option to disable blacklisting, both the queue check and the spec

pull/4/head
Mark McDowall 11 years ago
parent 4578adf1c0
commit 7c6fad155a

@ -275,6 +275,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("RemoveFailedDownloads", value); } set { SetValue("RemoveFailedDownloads", value); }
} }
public Boolean EnableFailedDownloadHandling
{
get { return GetValueBoolean("EnableFailedDownloadHandling", true); }
set { SetValue("EnableFailedDownloadHandling", value); }
}
public string DownloadClientWorkingFolders public string DownloadClientWorkingFolders
{ {
get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); } get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); }

@ -41,6 +41,7 @@ namespace NzbDrone.Core.Configuration
String DownloadClientWorkingFolders { get; set; } String DownloadClientWorkingFolders { get; set; }
Boolean AutoRedownloadFailed { get; set; } Boolean AutoRedownloadFailed { get; set; }
Boolean RemoveFailedDownloads { get; set; } Boolean RemoveFailedDownloads { get; set; }
Boolean EnableFailedDownloadHandling { get; set; }
void SaveValues(Dictionary<string, object> configValues); void SaveValues(Dictionary<string, object> configValues);
} }
} }

@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Blacklisting; using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -9,11 +10,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public class BlacklistSpecification : IDecisionEngineSpecification public class BlacklistSpecification : IDecisionEngineSpecification
{ {
private readonly IBlacklistService _blacklistService; private readonly IBlacklistService _blacklistService;
private readonly IConfigService _configService;
private readonly Logger _logger; private readonly Logger _logger;
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger) public BlacklistSpecification(IBlacklistService blacklistService, IConfigService configService, Logger logger)
{ {
_blacklistService = blacklistService; _blacklistService = blacklistService;
_configService = configService;
_logger = logger; _logger = logger;
} }
@ -27,9 +30,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria) public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
{ {
if (!_configService.EnableFailedDownloadHandling)
{
_logger.Trace("Failed Download Handling is not enabled");
return true;
}
if (_blacklistService.Blacklisted(subject.Release.Title)) if (_blacklistService.Blacklisted(subject.Release.Title))
{ {
_logger.Trace("Release is blacklisted"); _logger.Trace("{0} is blacklisted", subject.Release.Title);
return false; return false;
} }

@ -39,6 +39,12 @@ namespace NzbDrone.Core.Download
private void CheckForFailedDownloads() private void CheckForFailedDownloads()
{ {
if (!_configService.EnableFailedDownloadHandling)
{
_logger.Trace("Failed Download Handling is not enabled");
return;
}
var grabbedHistory = _historyService.Grabbed(); var grabbedHistory = _historyService.Grabbed();
var failedHistory = _historyService.Failed(); var failedHistory = _historyService.Failed();

@ -10,11 +10,28 @@ define(
template: 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate', template: 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate',
ui: { ui: {
recyclingBin: '.x-path' recyclingBin : '.x-path',
failedDownloadHandlingCheckbox: '.x-failed-download-handling',
failedDownloadOptions : '.x-failed-download-options'
},
events: {
'change .x-failed-download-handling': '_setFailedDownloadOptionsVisibility'
}, },
onShow: function () { onShow: function () {
this.ui.recyclingBin.autoComplete('/directories'); this.ui.recyclingBin.autoComplete('/directories');
},
_setFailedDownloadOptionsVisibility: function () {
var checked = this.ui.failedDownloadHandlingCheckbox.prop('checked');
if (checked) {
this.ui.failedDownloadOptions.slideDown();
}
else {
this.ui.failedDownloadOptions.slideUp();
}
} }
}); });

@ -57,11 +57,11 @@
<legend>Failed Download Handling</legend> <legend>Failed Download Handling</legend>
<div class="control-group"> <div class="control-group">
<label class="control-label">Redownload</label> <label class="control-label">Enable</label>
<div class="controls"> <div class="controls">
<label class="checkbox toggle well"> <label class="checkbox toggle well">
<input type="checkbox" name="autoRedownloadFailed"/> <input type="checkbox" name="enableFailedDownloadHandling" class="x-failed-download-handling"/>
<p> <p>
<span>Yes</span> <span>Yes</span>
<span>No</span> <span>No</span>
@ -71,28 +71,50 @@
</label> </label>
<span class="help-inline-checkbox"> <span class="help-inline-checkbox">
<i class="icon-question-sign" title="Automatically search for and attempt to download another release when a download fails?"/> <i class="icon-question-sign" title="Process failed downloads and blacklist the release"/>
</span> </span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="x-failed-download-options">
<label class="control-label">Remove</label> <div class="control-group">
<label class="control-label">Redownload</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="autoRedownloadFailed"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Automatically search for and attempt to download another release when a download fails?"/>
</span>
</div>
</div>
<div class="controls"> <div class="control-group">
<label class="checkbox toggle well"> <label class="control-label">Remove</label>
<input type="checkbox" name="removeFailedDownloads"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/> <div class="controls">
</label> <label class="checkbox toggle well">
<input type="checkbox" name="removeFailedDownloads"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<span class="help-inline-checkbox"> <div class="btn btn-primary slide-button"/>
<i class="icon-question-sign" title="Automatically remove failed downloads from history and encrypted downloads from queue?"/> </label>
</span>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Automatically remove failed downloads from history and encrypted downloads from queue?"/>
</span>
</div>
</div> </div>
</div> </div>
</fieldset> </fieldset>

@ -17,7 +17,7 @@ define(
}, },
events: { events: {
'change .x-rename-episodes': '_setNamingOptionsVisibility' 'change .x-rename-episodes': '_setFailedDownloadOptionsVisibility'
}, },
onRender: function () { onRender: function () {
@ -32,7 +32,7 @@ define(
this._updateSamples(); this._updateSamples();
}, },
_setNamingOptionsVisibility: function () { _setFailedDownloadOptionsVisibility: function () {
var checked = this.ui.renameEpisodesCheckbox.prop('checked'); var checked = this.ui.renameEpisodesCheckbox.prop('checked');
if (checked) { if (checked) {
this.ui.namingOptions.slideDown(); this.ui.namingOptions.slideDown();

Loading…
Cancel
Save