From 01e970e1a7317fd845d84cdb12756a1d052356b2 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 12 Sep 2022 21:27:32 -0500 Subject: [PATCH] New: (Avistaz) Genre Search Support Fixes #1097 --- src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs | 4 ++-- .../Avistaz/AvistazRequestGenerator.cs | 15 ++++++++++----- src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs | 4 ++-- .../Indexers/Definitions/PrivateHD.cs | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs b/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs index 69721505c..5a5b1ca53 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs @@ -36,11 +36,11 @@ namespace NzbDrone.Core.Indexers.Definitions { TvSearchParams = new List { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvdbId + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvdbId, TvSearchParam.Genre }, MovieSearchParams = new List { - MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId + MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId, MovieSearchParam.Genre } }; diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs index 16a099870..aceb18885 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public Action, DateTime?> CookiesUpdater { get; set; } // hook to adjust the search category - protected virtual List> GetBasicSearchParameters(int[] categories) + protected virtual List> GetBasicSearchParameters(int[] categories, string genre) { var categoryMapping = Capabilities.Categories.MapTorznabCapsToTrackers(categories).Distinct().ToList(); var qc = new List> // NameValueCollection don't support cat[]=19&cat[]=6 @@ -39,6 +39,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz qc.Add("discount[]", "1"); } + if (genre.IsNotNullOrWhiteSpace()) + { + qc.Add("tags", genre); + } + // resolution filter to improve the search if (!categories.Contains(NewznabStandardCategory.Movies.Id) && !categories.Contains(NewznabStandardCategory.TV.Id) && !categories.Contains(NewznabStandardCategory.Audio.Id)) @@ -76,7 +81,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) { - var parameters = GetBasicSearchParameters(searchCriteria.Categories); + var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre); if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace()) { @@ -98,7 +103,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) { - var parameters = GetBasicSearchParameters(searchCriteria.Categories); + var parameters = GetBasicSearchParameters(searchCriteria.Categories, null); parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim()); @@ -109,7 +114,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) { - var parameters = GetBasicSearchParameters(searchCriteria.Categories); + var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre); if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace()) { @@ -141,7 +146,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) { - var parameters = GetBasicSearchParameters(searchCriteria.Categories); + var parameters = GetBasicSearchParameters(searchCriteria.Categories, null); parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim()); diff --git a/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs b/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs index 0f872ee08..37019d1cf 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs @@ -36,11 +36,11 @@ namespace NzbDrone.Core.Indexers.Definitions { TvSearchParams = new List { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.Genre }, MovieSearchParams = new List { - MovieSearchParam.Q, MovieSearchParam.ImdbId + MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.Genre } }; diff --git a/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs b/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs index b8fd39c10..dc8feb1d2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs @@ -35,11 +35,11 @@ namespace NzbDrone.Core.Indexers.Definitions { TvSearchParams = new List { - TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvdbId + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.TvdbId, TvSearchParam.Genre }, MovieSearchParams = new List { - MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId + MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId, MovieSearchParam.Genre }, MusicSearchParams = new List {