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

This commit is contained in:
Mark McDowall 2013-10-28 17:41:35 -07:00
parent 4578adf1c0
commit 7c6fad155a
7 changed files with 84 additions and 22 deletions

View File

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

View File

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

View File

@ -1,6 +1,7 @@
using System.Linq;
using NLog;
using NzbDrone.Core.Blacklisting;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
@ -9,11 +10,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public class BlacklistSpecification : IDecisionEngineSpecification
{
private readonly IBlacklistService _blacklistService;
private readonly IConfigService _configService;
private readonly Logger _logger;
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger)
public BlacklistSpecification(IBlacklistService blacklistService, IConfigService configService, Logger logger)
{
_blacklistService = blacklistService;
_configService = configService;
_logger = logger;
}
@ -27,9 +30,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
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))
{
_logger.Trace("Release is blacklisted");
_logger.Trace("{0} is blacklisted", subject.Release.Title);
return false;
}

View File

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

View File

@ -10,11 +10,28 @@ define(
template: 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate',
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 () {
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();
}
}
});

View File

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

View File

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