mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
New: Add hour as interval unit for indexer limits
This commit is contained in:
@@ -7,20 +7,33 @@ namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public IndexerCommonSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.QueryLimit).GreaterThan(0).When(c => c.QueryLimit.HasValue).WithMessage("Should be greater than zero");
|
||||
RuleFor(c => c.QueryLimit)
|
||||
.GreaterThan(0)
|
||||
.When(c => c.QueryLimit.HasValue)
|
||||
.WithMessage("Should be greater than zero");
|
||||
|
||||
RuleFor(c => c.GrabLimit).GreaterThan(0).When(c => c.GrabLimit.HasValue).WithMessage("Should be greater than zero");
|
||||
RuleFor(c => c.GrabLimit)
|
||||
.GreaterThan(0)
|
||||
.When(c => c.GrabLimit.HasValue)
|
||||
.WithMessage("Should be greater than zero");
|
||||
}
|
||||
}
|
||||
|
||||
public class IndexerBaseSettings
|
||||
{
|
||||
private static readonly IndexerCommonSettingsValidator Validator = new ();
|
||||
|
||||
[FieldDefinition(1, Type = FieldType.Number, Label = "Query Limit", HelpText = "The number of queries within a rolling 24 hour period Prowlarr will allow to the site", Advanced = true)]
|
||||
[FieldDefinition(1, Type = FieldType.Number, Label = "Query Limit", HelpText = "The number of max queries as specified by the respective unit that Prowlarr will allow to the site", Advanced = true)]
|
||||
public int? QueryLimit { get; set; }
|
||||
|
||||
[FieldDefinition(2, Type = FieldType.Number, Label = "Grab Limit", HelpText = "The number of grabs within a rolling 24 hour period Prowlarr will allow to the site", Advanced = true)]
|
||||
[FieldDefinition(2, Type = FieldType.Number, Label = "Grab Limit", HelpText = "The number of max grabs as specified by the respective unit that Prowlarr will allow to the site", Advanced = true)]
|
||||
public int? GrabLimit { get; set; }
|
||||
|
||||
[FieldDefinition(3, Type = FieldType.Select, SelectOptions = typeof(IndexerLimitsUnit), Label = "Limits Unit", HelpText = "The unit of time for counting limits per indexer", Advanced = true)]
|
||||
public int LimitsUnit { get; set; } = (int)IndexerLimitsUnit.Day;
|
||||
}
|
||||
|
||||
public enum IndexerLimitsUnit
|
||||
{
|
||||
Day = 0,
|
||||
Hour = 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user