From 2e0c22eb6dc62ca7aa5ea5ebf6d624748588a968 Mon Sep 17 00:00:00 2001 From: morpheus133 Date: Mon, 11 Jun 2018 17:15:21 +0200 Subject: [PATCH] NCore: fix for #1450 (#3220) Some workoround to "Ncore - not forward all search results to Sonarr, Radarr" In case of TV shows if nothing is founded, retry the search without SxxExx after the show name. This will list all torrent also if their title or description are changed. Than add the result only if it contains the skipped SxxExx --- src/Jackett.Common/Indexers/NCore.cs | 32 ++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Jackett.Common/Indexers/NCore.cs b/src/Jackett.Common/Indexers/NCore.cs index eceafb727..48222fe12 100644 --- a/src/Jackett.Common/Indexers/NCore.cs +++ b/src/Jackett.Common/Indexers/NCore.cs @@ -117,12 +117,17 @@ namespace Jackett.Common.Indexers return IndexerConfigurationStatus.RequiresTesting; } - protected override async Task> PerformQuery(TorznabQuery query) + protected async Task> PerformQuery(TorznabQuery query, String seasonep) { var releases = new List(); var searchString = query.GetQueryString(); var pairs = new List>(); + if (seasonep != null) + { + searchString = Regex.Split(query.GetQueryString(), @"(?i)S\d+E?\d+\s?$")[0]; + } + pairs.Add(new KeyValuePair("nyit_sorozat_resz", "true")); pairs.Add(new KeyValuePair("miben", "name")); pairs.Add(new KeyValuePair("tipus", "kivalasztottak_kozott")); @@ -198,8 +203,18 @@ namespace Jackett.Common.Indexers string catlink = qRow.Find("a:has(img[class='categ_link'])").First().Attr("href"); string cat = ParseUtil.GetArgumentFromQueryString(catlink, "tipus"); release.Category = MapTrackerCatToNewznab(cat); + if (seasonep == null) + releases.Add(release); + + else + { + Match m = Regex.Match(release.Title, @""+ seasonep + @"\s?$", RegexOptions.IgnoreCase); + if (m.Success) + { + releases.Add(release); + } + } - releases.Add(release); } } catch (Exception ex) @@ -209,5 +224,18 @@ namespace Jackett.Common.Indexers return releases; } + + protected override async Task> PerformQuery(TorznabQuery query) + { + var results = await PerformQuery(query, null); + if (results.Count()==0 && query.IsTVSearch) + { + var regex = new Regex(@"(?i)S\d+E?\d+\s?$"); + String seasonepisode = regex.Match(query.GetQueryString()).Value; + results = await PerformQuery(query, seasonepisode.Trim()); + } + + return results; + } } }