From dbc4989a956e4a1662a506f2132e1968c2d17697 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 19 Feb 2023 15:46:47 -0600 Subject: [PATCH] Fixed: (IndexerSearch) Update isRss logic for new properties --- src/NzbDrone.Core/History/HistoryService.cs | 2 +- .../IndexerSearch/Definitions/BookSearchCriteria.cs | 8 +++++++- .../IndexerSearch/Definitions/MovieSearchCriteria.cs | 9 ++++++++- .../IndexerSearch/Definitions/MusicSearchCriteria.cs | 9 ++++++++- .../IndexerSearch/Definitions/SearchCriteriaBase.cs | 2 +- .../IndexerSearch/Definitions/TvSearchCriteria.cs | 12 +++++++++++- src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs | 4 ++-- 7 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs index 676e28fee..2dbefc8f7 100644 --- a/src/NzbDrone.Core/History/HistoryService.cs +++ b/src/NzbDrone.Core/History/HistoryService.cs @@ -122,7 +122,7 @@ namespace NzbDrone.Core.History { Date = DateTime.UtcNow, IndexerId = message.IndexerId, - EventType = message.Query.RssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery, + EventType = message.Query.IsRssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery, Successful = message.QueryResult.Response?.StatusCode == HttpStatusCode.OK }; diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/BookSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/BookSearchCriteria.cs index dcb40c9f5..0be33b033 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/BookSearchCriteria.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/BookSearchCriteria.cs @@ -10,6 +10,12 @@ namespace NzbDrone.Core.IndexerSearch.Definitions public int? Year { get; set; } public string Genre { get; set; } - public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && Author.IsNullOrWhiteSpace() && Title.IsNullOrWhiteSpace(); + public override bool IsRssSearch => + SearchTerm.IsNullOrWhiteSpace() && + Author.IsNullOrWhiteSpace() && + Title.IsNullOrWhiteSpace() && + Publisher.IsNullOrWhiteSpace() && + Genre.IsNullOrWhiteSpace() && + !Year.HasValue; } } diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/MovieSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/MovieSearchCriteria.cs index 6dbbff82c..5882d5113 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/MovieSearchCriteria.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/MovieSearchCriteria.cs @@ -13,7 +13,14 @@ namespace NzbDrone.Core.IndexerSearch.Definitions public int? Year { get; set; } public string Genre { get; set; } - public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TmdbId.HasValue && !TraktId.HasValue; + public override bool IsRssSearch => + SearchTerm.IsNullOrWhiteSpace() && + ImdbId.IsNullOrWhiteSpace() && + Genre.IsNullOrWhiteSpace() && + !TmdbId.HasValue && + !TraktId.HasValue && + !DoubanId.HasValue && + !Year.HasValue; public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId); diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/MusicSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/MusicSearchCriteria.cs index 85db08428..8f29a00f0 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/MusicSearchCriteria.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/MusicSearchCriteria.cs @@ -11,6 +11,13 @@ namespace NzbDrone.Core.IndexerSearch.Definitions public string Track { get; set; } public int? Year { get; set; } - public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && Album.IsNullOrWhiteSpace() && Artist.IsNullOrWhiteSpace() && Label.IsNullOrWhiteSpace(); + public override bool IsRssSearch => + SearchTerm.IsNullOrWhiteSpace() && + Album.IsNullOrWhiteSpace() && + Artist.IsNullOrWhiteSpace() && + Label.IsNullOrWhiteSpace() && + Genre.IsNullOrWhiteSpace() && + Track.IsNullOrWhiteSpace() && + !Year.HasValue; } } diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs index fb76ed829..8a5e12318 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions public virtual string SearchQuery => $"Term: [{SearchTerm}]"; - public virtual bool RssSearch => SearchTerm.IsNullOrWhiteSpace(); + public virtual bool IsRssSearch => SearchTerm.IsNullOrWhiteSpace(); public string SanitizedSearchTerm => GetSanitizedTerm(SearchTerm); diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/TvSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/TvSearchCriteria.cs index f2d0192c9..6d8ffeee5 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/TvSearchCriteria.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/TvSearchCriteria.cs @@ -26,7 +26,17 @@ namespace NzbDrone.Core.IndexerSearch.Definitions public string FullImdbId => ParseUtil.GetFullImdbId(ImdbId); - public override bool RssSearch => SearchTerm.IsNullOrWhiteSpace() && ImdbId.IsNullOrWhiteSpace() && !TvdbId.HasValue && !RId.HasValue && !TraktId.HasValue && !TvMazeId.HasValue; + public override bool IsRssSearch => + SearchTerm.IsNullOrWhiteSpace() && + Episode.IsNullOrWhiteSpace() && + ImdbId.IsNullOrWhiteSpace() && + !Season.HasValue && + !TvdbId.HasValue && + !RId.HasValue && + !TraktId.HasValue && + !TvMazeId.HasValue && + !TmdbId.HasValue && + !DoubanId.HasValue; public override string SearchQuery { diff --git a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs index 969c65b7e..4b995c717 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs @@ -129,7 +129,7 @@ namespace NzbDrone.Core.Indexers.Definitions { var pageableRequests = new IndexerPageableRequestChain(); - pageableRequests.Add(searchCriteria.RssSearch + pageableRequests.Add(searchCriteria.IsRssSearch ? GetRssRequest() : GetSearchRequests(searchCriteria.SanitizedTvSearchString)); @@ -147,7 +147,7 @@ namespace NzbDrone.Core.Indexers.Definitions { var pageableRequests = new IndexerPageableRequestChain(); - pageableRequests.Add(searchCriteria.RssSearch + pageableRequests.Add(searchCriteria.IsRssSearch ? GetRssRequest() : GetSearchRequests(searchCriteria.SanitizedSearchTerm));