mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Added: Option to require indexer flags per indexer. (e.g. only download freeleech torrents from a private tracker) (#2460)
This commit is contained in:
@@ -41,6 +41,16 @@ namespace NzbDrone.Api.ClientSchema
|
||||
};
|
||||
|
||||
var value = propertyInfo.GetValue(model, null);
|
||||
|
||||
if (propertyInfo.PropertyType.HasAttribute<FlagsAttribute>())
|
||||
{
|
||||
int intVal = (int)value;
|
||||
value = Enum.GetValues(propertyInfo.PropertyType)
|
||||
.Cast<int>()
|
||||
.Where(f=> (f & intVal) == f)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
field.Value = value;
|
||||
@@ -131,6 +141,12 @@ namespace NzbDrone.Api.ClientSchema
|
||||
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else if (propertyInfo.PropertyType.HasAttribute<FlagsAttribute>())
|
||||
{
|
||||
int value = field.Value.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Convert.ToInt32(s)).Sum();
|
||||
propertyInfo.SetValue(target, value, null);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user