Specific Subtitle tags (such as nlsub) can now be whitelisted and will be downloaded.

Fixes #540 and fixes a lot of other requests.
Leonardo Galli 8 years ago
parent 7066b078ab
commit c17deb7d92

@ -10,6 +10,7 @@ namespace NzbDrone.Api.Config
public int RssSyncInterval { get; set; } public int RssSyncInterval { get; set; }
public int AvailabilityDelay { get; set; } public int AvailabilityDelay { get; set; }
public bool AllowHardcodedSubs { get; set; } public bool AllowHardcodedSubs { get; set; }
public string WhitelistedHardcodedSubs { get; set; }
} }
public static class IndexerConfigResourceMapper public static class IndexerConfigResourceMapper
@ -23,6 +24,8 @@ namespace NzbDrone.Api.Config
RssSyncInterval = model.RssSyncInterval, RssSyncInterval = model.RssSyncInterval,
AvailabilityDelay = model.AvailabilityDelay, AvailabilityDelay = model.AvailabilityDelay,
AllowHardcodedSubs = model.AllowHardcodedSubs, AllowHardcodedSubs = model.AllowHardcodedSubs,
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
}; };
} }
} }

@ -197,6 +197,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("AllowHardcodedSubs", value); } set { SetValue("AllowHardcodedSubs", value); }
} }
public string WhitelistedHardcodedSubs
{
get { return GetValue("WhitelistedHardcodedSubs", ""); }
set { SetValue("WhitelistedHardcodedSubs", value); }
}
public bool RemoveCompletedDownloads public bool RemoveCompletedDownloads
{ {
get { return GetValueBoolean("RemoveCompletedDownloads", false); } get { return GetValueBoolean("RemoveCompletedDownloads", false); }

@ -49,6 +49,7 @@ namespace NzbDrone.Core.Configuration
int AvailabilityDelay { get; set; } int AvailabilityDelay { get; set; }
bool AllowHardcodedSubs { get; set; } bool AllowHardcodedSubs { get; set; }
string WhitelistedHardcodedSubs { get; set; }
int NetImportSyncInterval { get; set; } int NetImportSyncInterval { get; set; }
string ListSyncLevel { get; set; } string ListSyncLevel { get; set; }

@ -90,10 +90,19 @@ namespace NzbDrone.Core.DecisionEngine
decision = GetDecisionForReport(remoteMovie, searchCriteria); decision = GetDecisionForReport(remoteMovie, searchCriteria);
} }
else else
{
var whitelisted = _configService.WhitelistedHardcodedSubs.Split(',');
_logger.Debug("Testing: {0}", whitelisted);
if (whitelisted != null && whitelisted.Any(t => (parsedMovieInfo.Quality.HardcodedSubs.ToLower().Contains(t.ToLower()) && t.IsNotNullOrWhiteSpace())))
{
decision = GetDecisionForReport(remoteMovie, searchCriteria);
}
else
{ {
decision = new DownloadDecision(remoteMovie, new Rejection("Hardcoded subs found: " + parsedMovieInfo.Quality.HardcodedSubs)); decision = new DownloadDecision(remoteMovie, new Rejection("Hardcoded subs found: " + parsedMovieInfo.Quality.HardcodedSubs));
} }
} }
}
else else
{ {
remoteMovie.DownloadAllowed = true; remoteMovie.DownloadAllowed = true;

@ -1,9 +1,24 @@
var Marionette = require('marionette'); var Marionette = require('marionette');
var AsModelBoundView = require('../../../Mixins/AsModelBoundView'); var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
var AsValidatedView = require('../../../Mixins/AsValidatedView'); var AsValidatedView = require('../../../Mixins/AsValidatedView');
require('../../../Mixins/TagInput');
require('bootstrap');
require('bootstrap.tagsinput');
var view = Marionette.ItemView.extend({ var view = Marionette.ItemView.extend({
template : 'Settings/Indexers/Options/IndexerOptionsViewTemplate' template : 'Settings/Indexers/Options/IndexerOptionsViewTemplate',
ui : {
hcwhitelist : '.x-hcwhitelist',
},
onRender : function() {
this.ui.hcwhitelist.tagsinput({
trimValue : true,
allowDuplicates: true,
tagClass : 'label label-success'
});
},
}); });
AsModelBoundView.call(view); AsModelBoundView.call(view);

@ -38,6 +38,17 @@
</div> </div>
</div> </div>
<div class="form-group advanced-setting">
<label class="col-sm-3 control-label">Whitelisted Hardcoded Subs Tags</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-sonarr-form-info" title="All subtitle tags set here will not be considered hardcoded (e.g. dksub). This field is caseinsensitive and please put the tag in singular (dksub instead of dksubs)."/>
</div>
<div class="col-sm-2 col-sm-pull-1">
<input type="text" name="whitelistedHardcodedSubs" class="form-control x-hcwhitelist"/>
</div>
</div>
<div class="form-group advanced-setting"> <div class="form-group advanced-setting">
<label class="col-sm-3 control-label">Allow Hardcoded Subs</label> <label class="col-sm-3 control-label">Allow Hardcoded Subs</label>
<div class="col-sm-1 col-sm-push-2 help-inline"> <div class="col-sm-1 col-sm-push-2 help-inline">

Loading…
Cancel
Save