mirror of https://github.com/Jackett/Jackett
fix potato API
This commit is contained in:
parent
51aa4f35bd
commit
e9b604d3c4
|
@ -190,21 +190,23 @@ namespace Jackett.Indexers
|
|||
if (query == null)
|
||||
return false;
|
||||
var caps = TorznabCaps;
|
||||
if (!caps.SearchAvailable && query.IsSearch)
|
||||
return false;
|
||||
if (!caps.TVSearchAvailable && query.IsTVSearch)
|
||||
return false;
|
||||
if (!caps.MovieSearchAvailable && query.IsMovieSearch)
|
||||
return false;
|
||||
if (!caps.SupportsTVRageSearch && query.IsTVRageSearch)
|
||||
return false;
|
||||
if (!caps.SupportsImdbSearch && query.IsImdbQuery)
|
||||
return false;
|
||||
|
||||
if (query.HasSpecifiedCategories)
|
||||
if (!caps.SupportsCategories(query.Categories))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
if (caps.SearchAvailable && query.IsSearch)
|
||||
return true;
|
||||
if (caps.TVSearchAvailable && query.IsTVSearch)
|
||||
return true;
|
||||
if (caps.MovieSearchAvailable && query.IsMovieSearch)
|
||||
return true;
|
||||
if (caps.SupportsTVRageSearch && query.IsTVRageSearch)
|
||||
return true;
|
||||
if (caps.SupportsImdbSearch && query.IsImdbQuery)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Unconfigure()
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Jackett.Models.DTO
|
|||
public static TorznabQuery ToTorznabQuery(ApiSearch request)
|
||||
{
|
||||
var stringQuery = new TorznabQuery();
|
||||
stringQuery.QueryType = "search";
|
||||
|
||||
var queryStr = request.Query;
|
||||
if (queryStr != null)
|
||||
|
@ -30,7 +31,10 @@ namespace Jackett.Models.DTO
|
|||
}
|
||||
queryStr = queryStr.Trim();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
queryStr = ""; // empty string search is interpreted as null
|
||||
}
|
||||
|
||||
stringQuery.SearchTerm = queryStr;
|
||||
stringQuery.Categories = request.Category == 0 ? new int[0] : new int[1] { request.Category };
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Jackett.Models
|
|||
{
|
||||
get
|
||||
{
|
||||
return (QueryStringParts != null && QueryStringParts.Length > 0);
|
||||
return QueryType == "search";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ namespace Jackett.Models
|
|||
{
|
||||
get
|
||||
{
|
||||
return QueryType == "movie";
|
||||
return QueryType == "movie" || (QueryType == "TorrentPotato" && !string.IsNullOrWhiteSpace(SearchTerm));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ namespace Jackett.Services
|
|||
{
|
||||
var indexer = GetIndexer(name);
|
||||
var browseQuery = new TorznabQuery();
|
||||
browseQuery.QueryType = "search";
|
||||
browseQuery.SearchTerm = "";
|
||||
browseQuery.IsTest = true;
|
||||
var results = await indexer.ResultsForQuery(browseQuery);
|
||||
logger.Info(string.Format("Found {0} releases from {1}", results.Count(), indexer.DisplayName));
|
||||
|
|
Loading…
Reference in New Issue