mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-23 08:13:01 +00:00
Fixed: Newznab/Torznab used wrong query if tvrageid was unknown in combination with a specific indexer capability profile.
This commit is contained in:
parent
947f494e72
commit
4c5707bba8
2 changed files with 26 additions and 7 deletions
|
@ -234,6 +234,21 @@ public void should_not_use_aggregrated_id_search_if_no_ids_supported()
|
|||
page.Url.Query.Should().Contain("q=");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_aggregrated_id_search_if_no_ids_are_known()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "rid", "season", "ep" };
|
||||
_capabilities.SupportsAggregateIdSearch = true; // Turns true if indexer supplies supportedParams.
|
||||
|
||||
_singleEpisodeSearchCriteria.Series.TvRageId = 0;
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
|
||||
var page = results.GetTier(0).First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("q=");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_fallback_to_q()
|
||||
{
|
||||
|
|
|
@ -183,21 +183,25 @@ public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearc
|
|||
|
||||
private void AddTvIdPageableRequests(IndexerPageableRequestChain chain, int maxPages, IEnumerable<int> categories, SearchCriteriaBase searchCriteria, string parameters)
|
||||
{
|
||||
if (SupportsAggregatedIdSearch && (SupportsTvdbSearch || SupportsTvRageSearch || SupportsTvMazeSearch))
|
||||
var includeTvdbSearch = SupportsTvdbSearch && searchCriteria.Series.TvdbId > 0;
|
||||
var includeTvRageSearch = SupportsTvRageSearch && searchCriteria.Series.TvRageId > 0;
|
||||
var includeTvMazeSearch = SupportsTvMazeSearch && searchCriteria.Series.TvMazeId > 0;
|
||||
|
||||
if (SupportsAggregatedIdSearch && (includeTvdbSearch || includeTvRageSearch || includeTvMazeSearch))
|
||||
{
|
||||
var ids = "";
|
||||
|
||||
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch)
|
||||
if (includeTvdbSearch)
|
||||
{
|
||||
ids += "&tvdbid=" + searchCriteria.Series.TvdbId;
|
||||
}
|
||||
|
||||
if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
|
||||
if (includeTvRageSearch)
|
||||
{
|
||||
ids += "&rid=" + searchCriteria.Series.TvRageId;
|
||||
}
|
||||
|
||||
if (searchCriteria.Series.TvMazeId > 0 && SupportsTvMazeSearch)
|
||||
if (includeTvMazeSearch)
|
||||
{
|
||||
ids += "&tvmazeid=" + searchCriteria.Series.TvMazeId;
|
||||
}
|
||||
|
@ -206,18 +210,18 @@ private void AddTvIdPageableRequests(IndexerPageableRequestChain chain, int maxP
|
|||
}
|
||||
else
|
||||
{
|
||||
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch)
|
||||
if (includeTvdbSearch)
|
||||
{
|
||||
chain.Add(GetPagedRequests(maxPages, categories, "tvsearch",
|
||||
string.Format("&tvdbid={0}{1}", searchCriteria.Series.TvdbId, parameters)));
|
||||
}
|
||||
else if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
|
||||
else if (includeTvRageSearch)
|
||||
{
|
||||
chain.Add(GetPagedRequests(maxPages, categories, "tvsearch",
|
||||
string.Format("&rid={0}{1}", searchCriteria.Series.TvRageId, parameters)));
|
||||
}
|
||||
|
||||
else if (searchCriteria.Series.TvMazeId > 0 && SupportsTvMazeSearch)
|
||||
else if (includeTvMazeSearch)
|
||||
{
|
||||
chain.Add(GetPagedRequests(maxPages, categories, "tvsearch",
|
||||
string.Format("&tvmazeid={0}{1}", searchCriteria.Series.TvMazeId, parameters)));
|
||||
|
|
Loading…
Reference in a new issue