This commit is contained in:
Garfield69 2020-03-22 12:40:59 +13:00
commit 5978eb7263
1 changed files with 21 additions and 13 deletions

View File

@ -129,13 +129,11 @@ namespace Jackett.Common.Indexers
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var searchUrl = SearchUrl;
var queryCollection = new NameValueCollection();
queryCollection.Add("incldead", "1");
queryCollection.Add("rel_type", "0"); // Alle
var queryCollection = new NameValueCollection
{
{"incldead", "1"},
{"rel_type", "0"} // Alle
};
if (query.ImdbID != null)
{
@ -146,20 +144,30 @@ namespace Jackett.Common.Indexers
{
queryCollection.Add("searchin", "title");
if (!string.IsNullOrWhiteSpace(searchString))
if (!string.IsNullOrWhiteSpace(query.GetQueryString()))
{
// use AND+wildcard operator to avoid getting to many useless results
var searchStringArray = Regex.Split(searchString.Trim(), "[ _.-]+", RegexOptions.Compiled).ToList();
searchStringArray = searchStringArray.Select(x => "+" + x).ToList(); // add AND operators
var searchStringFinal = string.Join(" ", searchStringArray);
queryCollection.Add("search", searchStringFinal);
var searchStringArray = Regex.Split(
query.SanitizedSearchTerm, "[ _.-]+",
RegexOptions.Compiled).Select(term => $"+{term}");
// If only season search add * wildcard to get all episodes
var tvEpisode = query.GetEpisodeSearchString();
if (!string.IsNullOrWhiteSpace(tvEpisode))
{
if(tvEpisode.StartsWith("S") && !tvEpisode.Contains("E"))
tvEpisode += "*";
searchStringArray = searchStringArray.Append($"+{tvEpisode}");
}
queryCollection.Add("search", string.Join(" ", searchStringArray));
}
}
foreach (var cat in MapTorznabCapsToTrackers(query))
queryCollection.Add("c" + cat, "1");
searchUrl += "?" + queryCollection.GetQueryString();
var searchUrl = SearchUrl + "?" + queryCollection.GetQueryString();
var results = await RequestStringWithCookiesAndRetry(searchUrl);