mirror of
https://github.com/Prowlarr/Prowlarr
synced 2025-12-27 10:58:34 +01:00
Fixed: (BeyondHD) Add search types option
This commit is contained in:
parent
a4a50b880c
commit
07f816f9fd
1 changed files with 75 additions and 0 deletions
|
|
@ -132,6 +132,20 @@ private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCr
|
|||
body.Add("categories", string.Join(",", cats));
|
||||
}
|
||||
|
||||
if (_settings.SearchTypes.Any())
|
||||
{
|
||||
var searchTypes = _settings.SearchTypes
|
||||
.Cast<BeyondHDSearchType>()
|
||||
.Select(x => x.GetAttribute<FieldOptionAttribute>()?.Label)
|
||||
.Where(x => x != null)
|
||||
.ToHashSet();
|
||||
|
||||
if (searchTypes.Any())
|
||||
{
|
||||
body.Add("types", string.Join(",", searchTypes));
|
||||
}
|
||||
}
|
||||
|
||||
if (searchCriteria.Limit is > 0 && searchCriteria.Offset is > 0)
|
||||
{
|
||||
var page = (int)(searchCriteria.Offset / searchCriteria.Limit) + 1;
|
||||
|
|
@ -309,6 +323,7 @@ public BeyondHDSettings()
|
|||
LimitedOnly = false;
|
||||
RefundOnly = false;
|
||||
RewindOnly = false;
|
||||
SearchTypes = Array.Empty<int>();
|
||||
}
|
||||
|
||||
[FieldDefinition(2, Label = "API Key", HelpText = "API Key from the Site (Found in My Security => API Key)", Privacy = PrivacyLevel.ApiKey)]
|
||||
|
|
@ -329,12 +344,72 @@ public BeyondHDSettings()
|
|||
[FieldDefinition(7, Label = "Rewind Only", Type = FieldType.Checkbox, HelpText = "Search rewind only")]
|
||||
public bool RewindOnly { get; set; }
|
||||
|
||||
[FieldDefinition(8, Label = "Search Types", Type = FieldType.TagSelect, SelectOptions = typeof(BeyondHDSearchType), Advanced = true, HelpText = "Select the types of releases that you are interested in. If none selected, all options are used.")]
|
||||
public IEnumerable<int> SearchTypes { get; set; }
|
||||
|
||||
public override NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
|
||||
public enum BeyondHDSearchType
|
||||
{
|
||||
[FieldOption(Label = "UHD 100")]
|
||||
TypeUhd100,
|
||||
|
||||
[FieldOption(Label = "UHD 66")]
|
||||
TypeUhd66,
|
||||
|
||||
[FieldOption(Label = "UHD 50")]
|
||||
TypeUhd50,
|
||||
|
||||
[FieldOption(Label = "UHD Remux")]
|
||||
TypeUhdRemux,
|
||||
|
||||
[FieldOption(Label = "BD 50")]
|
||||
TypeBd50,
|
||||
|
||||
[FieldOption(Label = "BD 25")]
|
||||
TypeBd25,
|
||||
|
||||
[FieldOption(Label = "BD Remux")]
|
||||
TypeBdRemux,
|
||||
|
||||
[FieldOption(Label = "2160p")]
|
||||
Type2160P,
|
||||
|
||||
[FieldOption(Label = "1080p")]
|
||||
Type1080P,
|
||||
|
||||
[FieldOption(Label = "1080i")]
|
||||
Type1080I,
|
||||
|
||||
[FieldOption(Label = "720p")]
|
||||
Type720P,
|
||||
|
||||
[FieldOption(Label = "576p")]
|
||||
Type576P,
|
||||
|
||||
[FieldOption(Label = "540p")]
|
||||
Type540P,
|
||||
|
||||
[FieldOption(Label = "DVD 9")]
|
||||
TypeDvd9,
|
||||
|
||||
[FieldOption(Label = "DVD 5")]
|
||||
TypeDvd5,
|
||||
|
||||
[FieldOption(Label = "DVD Remux")]
|
||||
TypeDvdRemux,
|
||||
|
||||
[FieldOption(Label = "480p")]
|
||||
Type480P,
|
||||
|
||||
[FieldOption(Label = "Other")]
|
||||
TypeOther,
|
||||
}
|
||||
|
||||
public class BeyondHDResponse
|
||||
{
|
||||
[JsonProperty(PropertyName = "status_code")]
|
||||
|
|
|
|||
Loading…
Reference in a new issue