New: (Avistaz) Genre Search Support

Fixes #1097
pull/1126/head
Qstick 2 years ago
parent 68df439498
commit 01e970e1a7

@ -36,11 +36,11 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
TvSearchParams = new List<TvSearchParam> TvSearchParams = new List<TvSearchParam>
{ {
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> MovieSearchParams = new List<MovieSearchParam>
{ {
MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId, MovieSearchParam.Genre
} }
}; };

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; } public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
// hook to adjust the search category // hook to adjust the search category
protected virtual List<KeyValuePair<string, string>> GetBasicSearchParameters(int[] categories) protected virtual List<KeyValuePair<string, string>> GetBasicSearchParameters(int[] categories, string genre)
{ {
var categoryMapping = Capabilities.Categories.MapTorznabCapsToTrackers(categories).Distinct().ToList(); var categoryMapping = Capabilities.Categories.MapTorznabCapsToTrackers(categories).Distinct().ToList();
var qc = new List<KeyValuePair<string, string>> // NameValueCollection don't support cat[]=19&cat[]=6 var qc = new List<KeyValuePair<string, string>> // NameValueCollection don't support cat[]=19&cat[]=6
@ -39,6 +39,11 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
qc.Add("discount[]", "1"); qc.Add("discount[]", "1");
} }
if (genre.IsNotNullOrWhiteSpace())
{
qc.Add("tags", genre);
}
// resolution filter to improve the search // resolution filter to improve the search
if (!categories.Contains(NewznabStandardCategory.Movies.Id) && !categories.Contains(NewznabStandardCategory.TV.Id) && if (!categories.Contains(NewznabStandardCategory.Movies.Id) && !categories.Contains(NewznabStandardCategory.TV.Id) &&
!categories.Contains(NewznabStandardCategory.Audio.Id)) !categories.Contains(NewznabStandardCategory.Audio.Id))
@ -76,7 +81,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
{ {
var parameters = GetBasicSearchParameters(searchCriteria.Categories); var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre);
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace()) if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
{ {
@ -98,7 +103,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
{ {
var parameters = GetBasicSearchParameters(searchCriteria.Categories); var parameters = GetBasicSearchParameters(searchCriteria.Categories, null);
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim()); parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim());
@ -109,7 +114,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
{ {
var parameters = GetBasicSearchParameters(searchCriteria.Categories); var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre);
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace()) if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
{ {
@ -141,7 +146,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
{ {
var parameters = GetBasicSearchParameters(searchCriteria.Categories); var parameters = GetBasicSearchParameters(searchCriteria.Categories, null);
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim()); parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim());

@ -36,11 +36,11 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
TvSearchParams = new List<TvSearchParam> TvSearchParams = new List<TvSearchParam>
{ {
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep, TvSearchParam.ImdbId, TvSearchParam.Genre
}, },
MovieSearchParams = new List<MovieSearchParam> MovieSearchParams = new List<MovieSearchParam>
{ {
MovieSearchParam.Q, MovieSearchParam.ImdbId MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.Genre
} }
}; };

@ -35,11 +35,11 @@ namespace NzbDrone.Core.Indexers.Definitions
{ {
TvSearchParams = new List<TvSearchParam> TvSearchParams = new List<TvSearchParam>
{ {
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> MovieSearchParams = new List<MovieSearchParam>
{ {
MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId, MovieSearchParam.Genre
}, },
MusicSearchParams = new List<MusicSearchParam> MusicSearchParams = new List<MusicSearchParam>
{ {

Loading…
Cancel
Save