mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
Cleanup SearchCriteria, Pass Cats from Search to Indexers
This commit is contained in:
@@ -69,15 +69,10 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
};
|
||||
}
|
||||
|
||||
private TorznabSettings GetSettings(string url, string apiPath = null, int[] categories = null)
|
||||
private TorznabSettings GetSettings(string url, string apiPath = null)
|
||||
{
|
||||
var settings = new TorznabSettings { BaseUrl = url };
|
||||
|
||||
if (categories != null)
|
||||
{
|
||||
settings.Categories = categories;
|
||||
}
|
||||
|
||||
if (apiPath.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
settings.ApiPath = apiPath;
|
||||
@@ -110,17 +105,6 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
{
|
||||
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
|
||||
|
||||
var notSupported = Settings.Categories.Except(CategoryIds(capabilities.Categories));
|
||||
|
||||
if (notSupported.Any())
|
||||
{
|
||||
_logger.Warn($"{Definition.Name} does not support the following categories: {string.Join(", ", notSupported)}. You should probably remove them.");
|
||||
if (notSupported.Count() == Settings.Categories.Count())
|
||||
{
|
||||
return new ValidationFailure(string.Empty, $"This indexer does not support any of the selected categories! (You may need to turn on advanced settings to see them)");
|
||||
}
|
||||
}
|
||||
|
||||
if (capabilities.SearchParams != null && capabilities.SearchParams.Contains(SearchParam.Q))
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -28,14 +28,6 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
|
||||
public TorznabSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c).Custom((c, context) =>
|
||||
{
|
||||
if (c.Categories.Empty())
|
||||
{
|
||||
context.AddFailure("'Categories' must be provided");
|
||||
}
|
||||
});
|
||||
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.ApiPath).ValidUrlBase("/api");
|
||||
RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey);
|
||||
|
||||
Reference in New Issue
Block a user