1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-05 15:47:20 +02:00

Fixed: (HDBits) Increase search limit to 100 releases

This commit is contained in:
Bogdan 2023-11-14 15:13:45 +02:00
parent 17b398cf62
commit ae5dd84e0a
5 changed files with 31 additions and 31 deletions

View File

@ -11,7 +11,6 @@ public class HDBits : HttpIndexerBase<HDBitsSettings>
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public override bool SupportsRss => true;
public override bool SupportsSearch => true;
public override int PageSize => 30;
public HDBits(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
: base(httpClient, indexerStatusService, configService, parsingService, logger)
@ -20,7 +19,7 @@ public HDBits(IHttpClient httpClient, IIndexerStatusService indexerStatusService
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new HDBitsRequestGenerator() { Settings = Settings };
return new HDBitsRequestGenerator { Settings = Settings };
}
public override IParseIndexerResponse GetParser()

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace NzbDrone.Core.Indexers.HDBits
@ -7,19 +8,15 @@ public class TorrentQuery
{
[JsonProperty(Required = Required.Always)]
public string Username { get; set; }
[JsonProperty(Required = Required.Always)]
public string Passkey { get; set; }
public string Hash { get; set; }
public string Search { get; set; }
public int[] Category { get; set; }
public int[] Codec { get; set; }
public int[] Medium { get; set; }
public IEnumerable<int> Category { get; set; }
public IEnumerable<int> Codec { get; set; }
public IEnumerable<int> Medium { get; set; }
public int? Origin { get; set; }
[JsonProperty(PropertyName = "imdb")]
@ -33,6 +30,7 @@ public class TorrentQuery
[JsonProperty(PropertyName = "snatched_only")]
public bool? SnatchedOnly { get; set; }
public int? Limit { get; set; }
public int? Page { get; set; }

View File

@ -39,8 +39,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
jsonResponse.Message ?? string.Empty);
}
var responseData = jsonResponse.Data as JArray;
if (responseData == null)
if (jsonResponse.Data is not JArray responseData)
{
throw new IndexerException(indexerResponse,
"Indexer API call response missing result data");
@ -51,7 +50,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
foreach (var result in queryResults)
{
var id = result.Id;
var internalRelease = result.TypeOrigin == 1 ? true : false;
var internalRelease = result.TypeOrigin == 1;
IndexerFlags flags = 0;
@ -65,9 +64,9 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
flags |= IndexerFlags.G_Internal;
}
torrentInfos.Add(new HDBitsInfo()
torrentInfos.Add(new HDBitsInfo
{
Guid = string.Format("HDBits-{0}", id),
Guid = $"HDBits-{id}",
Title = result.Name,
Size = result.Size,
InfoHash = result.Hash,

View File

@ -45,8 +45,9 @@ private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searc
if (imdbId != 0)
{
query.ImdbInfo = query.ImdbInfo ?? new ImdbInfo();
query.ImdbInfo ??= new ImdbInfo();
query.ImdbInfo.Id = imdbId;
return true;
}
@ -74,6 +75,8 @@ private IEnumerable<IndexerRequest> GetRequest(TorrentQuery query)
query.Codec = Settings.Codecs.ToArray();
query.Medium = Settings.Mediums.ToArray();
query.Limit = 100;
request.SetContent(query.ToJson());
request.ContentSummary = query.ToJson(Formatting.None);

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using FluentValidation;
using NzbDrone.Core.Annotations;
@ -20,41 +21,41 @@ public HDBitsSettingsValidator()
public class HDBitsSettings : ITorrentIndexerSettings
{
private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator();
private static readonly HDBitsSettingsValidator Validator = new ();
public HDBitsSettings()
{
BaseUrl = "https://hdbits.org";
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
Categories = new int[] { (int)HdBitsCategory.Movie };
Codecs = System.Array.Empty<int>();
Mediums = System.Array.Empty<int>();
Categories = new[] { (int)HdBitsCategory.Movie };
Codecs = Array.Empty<int>();
Mediums = Array.Empty<int>();
MultiLanguages = new List<int>();
RequiredFlags = new List<int>();
}
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
public string Username { get; set; }
[FieldDefinition(0, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
public string BaseUrl { get; set; }
[FieldDefinition(1, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
public IEnumerable<int> MultiLanguages { get; set; }
[FieldDefinition(1, Label = "Username", Privacy = PrivacyLevel.UserName)]
public string Username { get; set; }
[FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
public string ApiKey { get; set; }
[FieldDefinition(3, Label = "API URL", Advanced = true, HelpText = "Do not change this unless you know what you're doing. Since your API key will be sent to that host.")]
public string BaseUrl { get; set; }
[FieldDefinition(4, Label = "Categories", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCategory), HelpText = "Options: Movie, TV, Documentary, Music, Sport, Audio, XXX, MiscDemo. If unspecified, all options are used.")]
[FieldDefinition(3, Label = "Categories", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCategory), HelpText = "Options: Movie, TV, Documentary, Music, Sport, Audio, XXX, MiscDemo. If unspecified, all options are used.")]
public IEnumerable<int> Categories { get; set; }
[FieldDefinition(5, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")]
[FieldDefinition(4, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")]
public IEnumerable<int> Codecs { get; set; }
[FieldDefinition(6, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")]
[FieldDefinition(5, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")]
public IEnumerable<int> Mediums { get; set; }
[FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(RealLanguageFieldConverter), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
public IEnumerable<int> MultiLanguages { get; set; }
[FieldDefinition(7, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
public int MinimumSeeders { get; set; }
@ -62,7 +63,7 @@ public HDBitsSettings()
public IEnumerable<int> RequiredFlags { get; set; }
[FieldDefinition(9)]
public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings();
public SeedCriteriaSettings SeedCriteria { get; set; } = new ();
public NzbDroneValidationResult Validate()
{