Fixed: Anime standard format search on Nyaa
This commit is contained in:
parent
f6ae9fd6c5
commit
a77ef187af
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
|
||||||
|
@ -28,7 +29,17 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
return new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
|
if (Settings.AnimeStandardFormatSearch && searchCriteria.SeasonNumber > 0 && searchCriteria.EpisodeNumber > 0)
|
||||||
|
{
|
||||||
|
foreach (var searchTitle in searchCriteria.SceneTitles.Select(PrepareQuery))
|
||||||
|
{
|
||||||
|
pageableRequests.Add(GetPagedRequests(MaxPages, $"{searchTitle}+s{searchCriteria.SeasonNumber:00}e{searchCriteria.EpisodeNumber:00}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
|
||||||
|
@ -37,10 +48,8 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
if (Settings.AnimeStandardFormatSearch && searchCriteria.SeasonNumber > 0)
|
if (Settings.AnimeStandardFormatSearch && searchCriteria.SeasonNumber > 0)
|
||||||
{
|
{
|
||||||
foreach (var queryTitle in searchCriteria.SceneTitles)
|
foreach (var searchTitle in searchCriteria.SceneTitles.Select(PrepareQuery))
|
||||||
{
|
{
|
||||||
var searchTitle = PrepareQuery(queryTitle);
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(MaxPages, $"{searchTitle}+s{searchCriteria.SeasonNumber:00}"));
|
pageableRequests.Add(GetPagedRequests(MaxPages, $"{searchTitle}+s{searchCriteria.SeasonNumber:00}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,10 +71,8 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
foreach (var queryTitle in searchCriteria.SceneTitles)
|
foreach (var searchTitle in searchCriteria.SceneTitles.Select(PrepareQuery))
|
||||||
{
|
{
|
||||||
var searchTitle = PrepareQuery(queryTitle);
|
|
||||||
|
|
||||||
if (searchCriteria.AbsoluteEpisodeNumber > 0)
|
if (searchCriteria.AbsoluteEpisodeNumber > 0)
|
||||||
{
|
{
|
||||||
pageableRequests.Add(GetPagedRequests(MaxPages, $"{searchTitle}+{searchCriteria.AbsoluteEpisodeNumber:0}"));
|
pageableRequests.Add(GetPagedRequests(MaxPages, $"{searchTitle}+{searchCriteria.AbsoluteEpisodeNumber:0}"));
|
||||||
|
@ -99,7 +106,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
|
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
|
||||||
{
|
{
|
||||||
var baseUrl = string.Format("{0}/?page=rss{1}", Settings.BaseUrl.TrimEnd('/'), Settings.AdditionalParameters);
|
var baseUrl = $"{Settings.BaseUrl.TrimEnd('/')}/?page=rss{Settings.AdditionalParameters}";
|
||||||
|
|
||||||
if (term != null)
|
if (term != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue