mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-20 22:14:34 -04:00
Newznab Responses for Caps and Movie Search (rough)
This commit is contained in:
@@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Usenet;
|
||||
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
||||
|
||||
public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).DefaultPageSize;
|
||||
public override int PageSize => _capabilitiesProvider.GetCapabilities(Settings).LimitsDefault.Value;
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
@@ -36,6 +36,14 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
return new NewznabRssParser(Settings);
|
||||
}
|
||||
|
||||
public override IndexerCapabilities GetCapabilities()
|
||||
{
|
||||
// TODO: This uses indexer capabilities when called so we don't have to keep up with all of them
|
||||
// however, this is not pulled on a all pull from UI, doing so will kill the UI load if an indexer is down
|
||||
// should we just purge and manage
|
||||
return _capabilitiesProvider.GetCapabilities(Settings);
|
||||
}
|
||||
|
||||
public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||
{
|
||||
get
|
||||
@@ -75,7 +83,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
Protocol = DownloadProtocol.Usenet,
|
||||
Privacy = IndexerPrivacy.Private,
|
||||
SupportsRss = SupportsRss,
|
||||
SupportsSearch = SupportsSearch
|
||||
SupportsSearch = SupportsSearch,
|
||||
Capabilities = Capabilities
|
||||
};
|
||||
}
|
||||
|
||||
@@ -107,15 +116,15 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
failures.AddIfNotNull(TestCapabilities());
|
||||
}
|
||||
|
||||
protected static List<int> CategoryIds(List<NewznabCategory> categories)
|
||||
protected static List<int> CategoryIds(List<IndexerCategory> categories)
|
||||
{
|
||||
var l = categories.Select(c => c.Id).ToList();
|
||||
|
||||
foreach (var category in categories)
|
||||
{
|
||||
if (category.Subcategories != null)
|
||||
if (category.SubCategories != null)
|
||||
{
|
||||
l.AddRange(CategoryIds(category.Subcategories));
|
||||
l.AddRange(CategoryIds(category.SubCategories));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,14 +148,14 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
}
|
||||
}
|
||||
|
||||
if (capabilities.SupportedSearchParameters != null && capabilities.SupportedSearchParameters.Contains("q"))
|
||||
if (capabilities.SearchParams != null && capabilities.SearchParams.Contains(SearchParam.Q))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (capabilities.SupportedMovieSearchParameters != null &&
|
||||
new[] { "q", "imdbid" }.Any(v => capabilities.SupportedMovieSearchParameters.Contains(v)) &&
|
||||
new[] { "imdbtitle", "imdbyear" }.All(v => capabilities.SupportedMovieSearchParameters.Contains(v)))
|
||||
if (capabilities.MovieSearchParams != null &&
|
||||
new[] { MovieSearchParam.Q, MovieSearchParam.ImdbId }.Any(v => capabilities.MovieSearchParams.Contains(v)) &&
|
||||
new[] { MovieSearchParam.ImdbTitle, MovieSearchParam.ImdbYear }.All(v => capabilities.MovieSearchParams.Contains(v)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user