mirror of
https://github.com/Jackett/Jackett
synced 2024-12-26 17:58:49 +00:00
TorrentSyndikat: Add wildcard to season only search.
This commit is contained in:
parent
c4b77eafb6
commit
15d3d08be7
1 changed files with 21 additions and 13 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue