enabled and indexerId placeholder
This commit is contained in:
parent
31cff12e43
commit
5cb1896af0
|
@ -30,7 +30,7 @@ function EditReleaseProfileModalContent(props) {
|
|||
|
||||
const {
|
||||
id,
|
||||
enableProfile,
|
||||
enabled,
|
||||
required,
|
||||
ignored,
|
||||
preferred,
|
||||
|
@ -52,9 +52,9 @@ function EditReleaseProfileModalContent(props) {
|
|||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="enableProfile"
|
||||
name="enabled"
|
||||
helpText="Check to enable release profile"
|
||||
{...enableProfile}
|
||||
{...enabled}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
|
|
@ -8,10 +8,12 @@ import { setReleaseProfileValue, saveReleaseProfile } from 'Store/Actions/settin
|
|||
import EditReleaseProfileModalContent from './EditReleaseProfileModalContent';
|
||||
|
||||
const newReleaseProfile = {
|
||||
enabled: false,
|
||||
required: '',
|
||||
ignored: '',
|
||||
preferred: [],
|
||||
includePreferredWhenRenaming: false,
|
||||
indexer: 0,
|
||||
tags: []
|
||||
};
|
||||
|
||||
|
|
|
@ -30,37 +30,45 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
_logger.Debug("Checking if release meets restrictions: {0}", subject);
|
||||
|
||||
var title = subject.Release.Title;
|
||||
var restrictions = _releaseProfileService.AllForTags(subject.Series.Tags);
|
||||
List<ReleaseProfile> restrictions = _releaseProfileService.AllForTags(subject.Series.Tags);
|
||||
|
||||
var required = restrictions.Where(r => r.Required.IsNotNullOrWhiteSpace());
|
||||
var ignored = restrictions.Where(r => r.Ignored.IsNotNullOrWhiteSpace());
|
||||
|
||||
foreach (var r in required)
|
||||
foreach (ReleaseProfile restriction in restrictions)
|
||||
{
|
||||
var requiredTerms = r.Required.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
var foundTerms = ContainsAny(requiredTerms, title);
|
||||
if (foundTerms.Empty())
|
||||
// TODO: attach Enabled and IndexerId fields to restriction
|
||||
/*if (!restriction.Enabled || restriction.IndexerId != subject.Release.IndexerId)
|
||||
{
|
||||
var terms = string.Join(", ", requiredTerms);
|
||||
_logger.Debug("[{0}] does not contain one of the required terms: {1}", title, terms);
|
||||
return Decision.Reject("Does not contain one of the required terms: {0}", terms);
|
||||
continue;
|
||||
}*/
|
||||
|
||||
var required = restrictions.Where(r => r.Required.IsNotNullOrWhiteSpace());
|
||||
var ignored = restrictions.Where(r => r.Ignored.IsNotNullOrWhiteSpace());
|
||||
|
||||
foreach (var r in required)
|
||||
{
|
||||
var requiredTerms = r.Required.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
var foundTerms = ContainsAny(requiredTerms, title);
|
||||
if (foundTerms.Empty())
|
||||
{
|
||||
var terms = string.Join(", ", requiredTerms);
|
||||
_logger.Debug("[{0}] does not contain one of the required terms: {1}", title, terms);
|
||||
return Decision.Reject("Does not contain one of the required terms: {0}", terms);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var r in ignored)
|
||||
{
|
||||
var ignoredTerms = r.Ignored.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
var foundTerms = ContainsAny(ignoredTerms, title);
|
||||
if (foundTerms.Any())
|
||||
{
|
||||
var terms = string.Join(", ", foundTerms);
|
||||
_logger.Debug("[{0}] contains these ignored terms: {1}", title, terms);
|
||||
return Decision.Reject("Contains these ignored terms: {0}", terms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var r in ignored)
|
||||
{
|
||||
var ignoredTerms = r.Ignored.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
var foundTerms = ContainsAny(ignoredTerms, title);
|
||||
if (foundTerms.Any())
|
||||
{
|
||||
var terms = string.Join(", ", foundTerms);
|
||||
_logger.Debug("[{0}] contains these ignored terms: {1}", title, terms);
|
||||
return Decision.Reject("Contains these ignored terms: {0}", terms);
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Debug("[{0}] No restrictions apply, allowing", subject);
|
||||
return Decision.Accept();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue