Added tiered indexer requests to support fallback to wildcard queries.

This commit is contained in:
Taloth Saldono 2015-10-09 20:56:40 +02:00
parent 88ce0ec487
commit 1ad1d73c91
22 changed files with 452 additions and 364 deletions

View File

@ -53,9 +53,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{ {
var results = Subject.GetRecentRequests(); var results = Subject.GetRecentRequests();
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("&cat=1,2,3,4&"); page.Url.Query.Should().Contain("&cat=1,2,3,4&");
} }
@ -67,9 +67,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
var results = Subject.GetRecentRequests(); var results = Subject.GetRecentRequests();
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("&cat=1,2,3,4&"); page.Url.Query.Should().Contain("&cat=1,2,3,4&");
} }
@ -79,9 +79,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{ {
var results = Subject.GetSearchRequests(_animeSearchCriteria); var results = Subject.GetSearchRequests(_animeSearchCriteria);
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("&cat=3,4&"); page.Url.Query.Should().Contain("&cat=3,4&");
} }
@ -91,9 +91,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{ {
var results = Subject.GetSearchRequests(_animeSearchCriteria); var results = Subject.GetSearchRequests(_animeSearchCriteria);
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("?t=search&"); page.Url.Query.Should().Contain("?t=search&");
} }
@ -103,9 +103,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{ {
var results = Subject.GetSearchRequests(_animeSearchCriteria); var results = Subject.GetSearchRequests(_animeSearchCriteria);
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var pages = results.First().Take(3).ToList(); var pages = results.GetAllTiers().First().Take(3).ToList();
pages[0].Url.Query.Should().Contain("&offset=0&"); pages[0].Url.Query.Should().Contain("&offset=0&");
pages[1].Url.Query.Should().Contain("&offset=100&"); pages[1].Url.Query.Should().Contain("&offset=100&");
@ -117,9 +117,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{ {
var results = Subject.GetSearchRequests(_animeSearchCriteria); var results = Subject.GetSearchRequests(_animeSearchCriteria);
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var pages = results.First().Take(500).ToList(); var pages = results.GetAllTiers().First().Take(500).ToList();
pages.Count.Should().BeLessThan(500); pages.Count.Should().BeLessThan(500);
} }
@ -131,9 +131,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria); var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.Should().HaveCount(1); results.GetAllTiers().Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().NotContain("rid=10"); page.Url.Query.Should().NotContain("rid=10");
page.Url.Query.Should().Contain("q=Monkey"); page.Url.Query.Should().Contain("q=Monkey");
@ -143,9 +143,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
public void should_search_by_rid_if_supported() public void should_search_by_rid_if_supported()
{ {
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria); var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.Should().HaveCount(1); results.GetTier(0).Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("rid=10"); page.Url.Query.Should().Contain("rid=10");
} }
@ -156,10 +156,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" }; _capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria); var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1); var page = results.GetAllTiers().First().First();
var page = results.First().First();
page.Url.Query.Should().NotContain("rid=10"); page.Url.Query.Should().NotContain("rid=10");
page.Url.Query.Should().Contain("q=Monkey"); page.Url.Query.Should().Contain("q=Monkey");
@ -171,9 +170,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "season", "ep" }; _capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "season", "ep" };
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria); var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.Should().HaveCount(1); results.GetTier(0).Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("tvdbid=20"); page.Url.Query.Should().Contain("tvdbid=20");
} }
@ -184,12 +183,43 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" }; _capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria); var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.Should().HaveCount(1); results.GetTier(0).Should().HaveCount(1);
var page = results.First().First(); var page = results.GetAllTiers().First().First();
page.Url.Query.Should().Contain("tvdbid=20"); page.Url.Query.Should().Contain("tvdbid=20");
page.Url.Query.Should().NotContain("rid=10"); page.Url.Query.Should().NotContain("rid=10");
} }
[Test]
public void should_use_aggregrated_id_search_if_supported()
{
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
_capabilities.SupportsAggregateIdSearch = true;
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
var page = results.GetTier(0).First().First();
page.Url.Query.Should().Contain("tvdbid=20");
page.Url.Query.Should().Contain("rid=10");
}
[Test]
public void should_fallback_to_q()
{
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
_capabilities.SupportsAggregateIdSearch = true;
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
results.Tiers.Should().Be(2);
var pageTier2 = results.GetTier(1).First().First();
pageTier2.Url.Query.Should().NotContain("tvdbid=20");
pageTier2.Url.Query.Should().NotContain("rid=10");
pageTier2.Url.Query.Should().Contain("q=");
}
} }
} }

View File

@ -43,8 +43,11 @@ namespace NzbDrone.Core.Test.IndexerTests
.With(v => v.HttpRequest.Method = HttpMethod.GET) .With(v => v.HttpRequest.Method = HttpMethod.GET)
.Build(); .Build();
var pageable = new IndexerPageableRequestChain();
pageable.Add(requests);
requestGenerator.Setup(s => s.GetSearchRequests(It.IsAny<SeasonSearchCriteria>())) requestGenerator.Setup(s => s.GetSearchRequests(It.IsAny<SeasonSearchCriteria>()))
.Returns(new List<IEnumerable<IndexerRequest>> { requests }); .Returns(pageable);
var parser = Mocker.GetMock<IParseIndexerResponse>(); var parser = Mocker.GetMock<IParseIndexerResponse>();
Subject._parser = parser.Object; Subject._parser = parser.Object;

View File

@ -10,38 +10,38 @@ namespace NzbDrone.Core.Indexers.BitMeTv
{ {
public BitMeTvSettings Settings { get; set; } public BitMeTvSettings Settings { get; set; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetRssRequests()); pageableRequests.Add(GetRssRequests());
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetRssRequests() private IEnumerable<IndexerRequest> GetRssRequests()

View File

@ -19,18 +19,18 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
PageSize = 100; PageSize = 100;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, null)); pageableRequests.Add(GetPagedRequests(MaxPages, null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequest = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery(); var parameters = new BroadcastheNetTorrentQuery();
if (AddSeriesSearchParameters(parameters, searchCriteria)) if (AddSeriesSearchParameters(parameters, searchCriteria))
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Category = "Episode"; parameters.Category = "Episode";
parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber); parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct()) foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
@ -52,42 +52,42 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Category = "Season"; parameters.Category = "Season";
parameters.Name = string.Format("Season {0}", seasonNumber); parameters.Name = string.Format("Season {0}", seasonNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
} }
return pageableRequest; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequest = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery(); var parameters = new BroadcastheNetTorrentQuery();
if (AddSeriesSearchParameters(parameters, searchCriteria)) if (AddSeriesSearchParameters(parameters, searchCriteria))
{ {
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct()) foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
{ {
parameters.Category = "Episode";
parameters.Name = string.Format("S{0:00}E%", seasonNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters));
parameters = parameters.Clone();
parameters.Category = "Season"; parameters.Category = "Season";
parameters.Name = string.Format("Season {0}", seasonNumber); parameters.Name = string.Format("Season {0}", seasonNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
parameters = parameters.Clone();
parameters.Category = "Episode";
parameters.Name = string.Format("S{0:00}E%", seasonNumber);
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
} }
return pageableRequest; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequest = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery(); var parameters = new BroadcastheNetTorrentQuery();
if (AddSeriesSearchParameters(parameters, searchCriteria)) if (AddSeriesSearchParameters(parameters, searchCriteria))
@ -95,15 +95,15 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Category = "Episode"; parameters.Category = "Episode";
parameters.Name = string.Format("{0:yyyy}.{0:MM}.{0:dd}", searchCriteria.AirDate); parameters.Name = string.Format("{0:yyyy}.{0:MM}.{0:dd}", searchCriteria.AirDate);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
return pageableRequest; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequest = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery(); var parameters = new BroadcastheNetTorrentQuery();
if (AddSeriesSearchParameters(parameters, searchCriteria)) if (AddSeriesSearchParameters(parameters, searchCriteria))
@ -115,7 +115,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Category = "Episode"; parameters.Category = "Episode";
parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber); parameters.Name = string.Format("S{0:00}E{1:00}", episode.SeasonNumber, episode.EpisodeNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct()) foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
@ -125,16 +125,16 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Category = "Season"; parameters.Category = "Season";
parameters.Name = string.Format("Season {0}", seasonNumber); parameters.Name = string.Format("Season {0}", seasonNumber);
pageableRequest.AddIfNotNull(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
} }
return pageableRequest; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private bool AddSeriesSearchParameters(BroadcastheNetTorrentQuery parameters, SearchCriteriaBase searchCriteria) private bool AddSeriesSearchParameters(BroadcastheNetTorrentQuery parameters, SearchCriteriaBase searchCriteria)

View File

@ -21,33 +21,33 @@ namespace NzbDrone.Core.Indexers.Fanzub
PageSize = 100; PageSize = 100;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(null)); pageableRequests.Add(GetPagedRequests(null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var searchTitles = searchCriteria.QueryTitles.SelectMany(v => GetTitleSearchStrings(v, searchCriteria.AbsoluteEpisodeNumber)).ToList(); var searchTitles = searchCriteria.QueryTitles.SelectMany(v => GetTitleSearchStrings(v, searchCriteria.AbsoluteEpisodeNumber)).ToList();
@ -56,9 +56,9 @@ namespace NzbDrone.Core.Indexers.Fanzub
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetPagedRequests(string query) private IEnumerable<IndexerRequest> GetPagedRequests(string query)

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
@ -11,18 +12,18 @@ namespace NzbDrone.Core.Indexers.HDBits
{ {
public HDBitsSettings Settings { get; set; } public HDBitsSettings Settings { get; set; }
public IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(new TorrentQuery())); pageableRequests.Add(GetRequest(new TorrentQuery()));
return pageableRequests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
var requests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var queryBase = new TorrentQuery(); var queryBase = new TorrentQuery();
if (TryAddSearchParameters(queryBase, searchCriteria)) if (TryAddSearchParameters(queryBase, searchCriteria))
@ -36,32 +37,32 @@ namespace NzbDrone.Core.Indexers.HDBits
} }
} }
return requests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var requests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var query = new TorrentQuery(); var query = new TorrentQuery();
if (TryAddSearchParameters(query, searchCriteria)) if (TryAddSearchParameters(query, searchCriteria))
{ {
query.Search = string.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate); query.Search = string.Format("{0:yyyy}-{0:MM}-{0:dd}", searchCriteria.AirDate);
requests.Add(GetRequest(query)); pageableRequests.Add(GetRequest(query));
} }
return requests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var requests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var queryBase = new TorrentQuery(); var queryBase = new TorrentQuery();
if (TryAddSearchParameters(queryBase, searchCriteria)) if (TryAddSearchParameters(queryBase, searchCriteria))
@ -72,16 +73,16 @@ namespace NzbDrone.Core.Indexers.HDBits
query.TvdbInfo.Season = seasonNumber; query.TvdbInfo.Season = seasonNumber;
requests.Add(GetRequest(query)); pageableRequests.Add(GetRequest(query));
} }
} }
return requests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var requests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var queryBase = new TorrentQuery(); var queryBase = new TorrentQuery();
if (TryAddSearchParameters(queryBase, searchCriteria)) if (TryAddSearchParameters(queryBase, searchCriteria))
@ -93,11 +94,11 @@ namespace NzbDrone.Core.Indexers.HDBits
query.TvdbInfo.Season = episode.SeasonNumber; query.TvdbInfo.Season = episode.SeasonNumber;
query.TvdbInfo.Episode = episode.EpisodeNumber; query.TvdbInfo.Episode = episode.EpisodeNumber;
requests.Add(GetRequest(query)); pageableRequests.Add(GetRequest(query));
} }
} }
return requests; return pageableRequests;
} }
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria) private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria)

View File

@ -111,7 +111,7 @@ namespace NzbDrone.Core.Indexers
return FetchReleases(generator.GetSearchRequests(searchCriteria)); return FetchReleases(generator.GetSearchRequests(searchCriteria));
} }
protected virtual IList<ReleaseInfo> FetchReleases(IList<IEnumerable<IndexerRequest>> pageableRequests, bool isRecent = false) protected virtual IList<ReleaseInfo> FetchReleases(IndexerPageableRequestChain pageableRequestChain, bool isRecent = false)
{ {
var releases = new List<ReleaseInfo>(); var releases = new List<ReleaseInfo>();
var url = string.Empty; var url = string.Empty;
@ -127,6 +127,10 @@ namespace NzbDrone.Core.Indexers
lastReleaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id); lastReleaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id);
} }
for (int i = 0; i < pageableRequestChain.Tiers; i++)
{
var pageableRequests = pageableRequestChain.GetTier(i);
foreach (var pageableRequest in pageableRequests) foreach (var pageableRequest in pageableRequests)
{ {
var pagedReleases = new List<ReleaseInfo>(); var pagedReleases = new List<ReleaseInfo>();
@ -174,6 +178,12 @@ namespace NzbDrone.Core.Indexers
releases.AddRange(pagedReleases); releases.AddRange(pagedReleases);
} }
if (releases.Any())
{
break;
}
}
if (isRecent && !releases.Empty()) if (isRecent && !releases.Empty())
{ {
var ordered = releases.OrderByDescending(v => v.PublishDate).ToList(); var ordered = releases.OrderByDescending(v => v.PublishDate).ToList();
@ -277,7 +287,7 @@ namespace NzbDrone.Core.Indexers
{ {
var parser = GetParser(); var parser = GetParser();
var generator = GetRequestGenerator(); var generator = GetRequestGenerator();
var releases = FetchPage(generator.GetRecentRequests().First().First(), parser); var releases = FetchPage(generator.GetRecentRequests().GetAllTiers().First().First(), parser);
if (releases.Empty()) if (releases.Empty())
{ {

View File

@ -5,11 +5,11 @@ namespace NzbDrone.Core.Indexers
{ {
public interface IIndexerRequestGenerator public interface IIndexerRequestGenerator
{ {
IList<IEnumerable<IndexerRequest>> GetRecentRequests(); IndexerPageableRequestChain GetRecentRequests();
IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria); IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria);
IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria); IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria);
IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria); IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria);
IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria); IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria);
IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria); IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria);
} }
} }

View File

@ -9,38 +9,38 @@ namespace NzbDrone.Core.Indexers.IPTorrents
{ {
public IPTorrentsSettings Settings { get; set; } public IPTorrentsSettings Settings { get; set; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetRssRequests()); pageableRequests.Add(GetRssRequests());
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetRssRequests() private IEnumerable<IndexerRequest> GetRssRequests()

View File

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
namespace NzbDrone.Core.Indexers
{
public class IndexerPageableRequest : IEnumerable<IndexerRequest>
{
private readonly IEnumerable<IndexerRequest> _enumerable;
public IndexerPageableRequest(IEnumerable<IndexerRequest> enumerable)
{
_enumerable = enumerable;
}
public IEnumerator<IndexerRequest> GetEnumerator()
{
return _enumerable.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _enumerable.GetEnumerator();
}
}
}

View File

@ -0,0 +1,51 @@
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Core.Indexers
{
public class IndexerPageableRequestChain
{
private List<List<IndexerPageableRequest>> _chains;
public IndexerPageableRequestChain()
{
_chains = new List<List<IndexerPageableRequest>>();
_chains.Add(new List<IndexerPageableRequest>());
}
public int Tiers
{
get { return _chains.Count; }
}
public IEnumerable<IndexerPageableRequest> GetAllTiers()
{
return _chains.SelectMany(v => v);
}
public IEnumerable<IndexerPageableRequest> GetTier(int index)
{
return _chains[index];
}
public void Add(IEnumerable<IndexerRequest> request)
{
if (request == null) return;
_chains.Last().Add(new IndexerPageableRequest(request));
}
public void AddTier(IEnumerable<IndexerRequest> request)
{
AddTier();
Add(request);
}
public void AddTier()
{
if (_chains.Last().Count == 0) return;
_chains.Add(new List<IndexerPageableRequest>());
}
}
}

View File

@ -20,28 +20,28 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
PageSize = 25; PageSize = 25;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "tv")); pageableRequests.Add(GetPagedRequests(MaxPages, "tv"));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
"category:tv", "category:tv",
string.Format("season:{0}", searchCriteria.SeasonNumber), string.Format("season:{0}", searchCriteria.SeasonNumber),
string.Format("episode:{0}", searchCriteria.EpisodeNumber))); string.Format("episode:{0}", searchCriteria.EpisodeNumber)));
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
string.Format("S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber), string.Format("S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber),
"category:tv")); "category:tv"));
@ -50,18 +50,18 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
"category:tv", "category:tv",
string.Format("season:{0}", searchCriteria.SeasonNumber))); string.Format("season:{0}", searchCriteria.SeasonNumber)));
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
"category:tv", "category:tv",
string.Format("S{0:00}", searchCriteria.SeasonNumber))); string.Format("S{0:00}", searchCriteria.SeasonNumber)));
@ -70,13 +70,13 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
string.Format("{0:yyyy-MM-dd}", searchCriteria.AirDate), string.Format("{0:yyyy-MM-dd}", searchCriteria.AirDate),
"category:tv")); "category:tv"));
@ -85,18 +85,18 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.EpisodeQueryTitles) foreach (var queryTitle in searchCriteria.EpisodeQueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, "usearch", pageableRequests.Add(GetPagedRequests(MaxPages, "usearch",
PrepareQuery(queryTitle), PrepareQuery(queryTitle),
"category:tv")); "category:tv"));
} }

View File

@ -72,128 +72,63 @@ namespace NzbDrone.Core.Indexers.Newznab
} }
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
var capabilities = _capabilitiesProvider.GetCapabilities(Settings); var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
if (capabilities.SupportedTvSearchParameters != null) if (capabilities.SupportedTvSearchParameters != null)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "tvsearch", "")); pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "tvsearch", ""));
} }
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch) AddTvIdPageableRequests(pageableRequests, MaxPages, Settings.Categories, searchCriteria,
{ string.Format("&season={0}&ep={1}",
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&tvdbid={0}&season={1}&ep={2}",
searchCriteria.Series.TvdbId,
searchCriteria.SeasonNumber, searchCriteria.SeasonNumber,
searchCriteria.EpisodeNumber))); searchCriteria.EpisodeNumber));
}
else if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&rid={0}&season={1}&ep={2}",
searchCriteria.Series.TvRageId,
searchCriteria.SeasonNumber,
searchCriteria.EpisodeNumber)));
}
else if (SupportsTvSearch)
{
foreach (var queryTitle in searchCriteria.QueryTitles)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&q={0}&season={1}&ep={2}",
NewsnabifyTitle(queryTitle),
searchCriteria.SeasonNumber,
searchCriteria.EpisodeNumber)));
}
}
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch) AddTvIdPageableRequests(pageableRequests, MaxPages, Settings.Categories, searchCriteria,
{ string.Format("&season={0}",
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch", searchCriteria.SeasonNumber));
string.Format("&tvdbid={0}&season={1}",
searchCriteria.Series.TvdbId,
searchCriteria.SeasonNumber)));
}
else if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&rid={0}&season={1}",
searchCriteria.Series.TvRageId,
searchCriteria.SeasonNumber)));
}
else if (SupportsTvSearch)
{
foreach (var queryTitle in searchCriteria.QueryTitles)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&q={0}&season={1}",
NewsnabifyTitle(queryTitle),
searchCriteria.SeasonNumber)));
}
}
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch) AddTvIdPageableRequests(pageableRequests, MaxPages, Settings.Categories, searchCriteria,
{ string.Format("&season={0:yyyy}&ep={0:MM}/{0:dd}",
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch", searchCriteria.AirDate));
string.Format("&tvdbid={0}&season={1:yyyy}&ep={1:MM}/{1:dd}",
searchCriteria.Series.TvdbId,
searchCriteria.AirDate)));
}
else if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&rid={0}&season={1:yyyy}&ep={1:MM}/{1:dd}",
searchCriteria.Series.TvRageId,
searchCriteria.AirDate)));
}
else if (SupportsTvSearch)
{
foreach (var queryTitle in searchCriteria.QueryTitles)
{
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&q={0}&season={1:yyyy}&ep={1:MM}/{1:dd}",
NewsnabifyTitle(queryTitle),
searchCriteria.AirDate)));
}
}
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
if (SupportsSearch) if (SupportsSearch)
{ {
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.AnimeCategories, "search", pageableRequests.Add(GetPagedRequests(MaxPages, Settings.AnimeCategories, "search",
string.Format("&q={0}+{1:00}", string.Format("&q={0}+{1:00}",
NewsnabifyTitle(queryTitle), NewsnabifyTitle(queryTitle),
searchCriteria.AbsoluteEpisodeNumber))); searchCriteria.AbsoluteEpisodeNumber)));
@ -203,9 +138,9 @@ namespace NzbDrone.Core.Indexers.Newznab
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
if (SupportsSearch) if (SupportsSearch)
{ {
@ -214,7 +149,7 @@ namespace NzbDrone.Core.Indexers.Newznab
var query = queryTitle.Replace('+', ' '); var query = queryTitle.Replace('+', ' ');
query = System.Web.HttpUtility.UrlEncode(query); query = System.Web.HttpUtility.UrlEncode(query);
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "search", pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "search",
string.Format("&q={0}", string.Format("&q={0}",
query))); query)));
} }
@ -223,6 +158,34 @@ namespace NzbDrone.Core.Indexers.Newznab
return pageableRequests; return pageableRequests;
} }
private void AddTvIdPageableRequests(IndexerPageableRequestChain chain, int maxPages, IEnumerable<int> categories, SearchCriteriaBase searchCriteria, string parameters)
{
{
if (searchCriteria.Series.TvdbId > 0 && SupportsTvdbSearch)
{
chain.Add(GetPagedRequests(maxPages, categories, "tvsearch",
string.Format("&tvdbid={0}{1}", searchCriteria.Series.TvdbId, parameters)));
}
else if (searchCriteria.Series.TvRageId > 0 && SupportsTvRageSearch)
{
chain.Add(GetPagedRequests(maxPages, categories, "tvsearch",
string.Format("&rid={0}{1}", searchCriteria.Series.TvRageId, parameters)));
}
}
if (SupportsTvSearch)
{
chain.AddTier();
foreach (var queryTitle in searchCriteria.QueryTitles)
{
chain.Add(GetPagedRequests(MaxPages, Settings.Categories, "tvsearch",
string.Format("&q={0}{1}",
NewsnabifyTitle(queryTitle),
parameters)));
}
}
}
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, IEnumerable<int> categories, string searchType, string parameters) private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, IEnumerable<int> categories, string searchType, string parameters)
{ {
if (categories.Empty()) if (categories.Empty())

View File

@ -19,46 +19,46 @@ namespace NzbDrone.Core.Indexers.Nyaa
PageSize = 100; PageSize = 100;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, null)); pageableRequests.Add(GetPagedRequests(MaxPages, null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
var searchTitle = PrepareQuery(queryTitle); var searchTitle = PrepareQuery(queryTitle);
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
string.Format("&term={0}+{1:0}", string.Format("&term={0}+{1:0}",
searchTitle, searchTitle,
searchCriteria.AbsoluteEpisodeNumber))); searchCriteria.AbsoluteEpisodeNumber)));
if (searchCriteria.AbsoluteEpisodeNumber < 10) if (searchCriteria.AbsoluteEpisodeNumber < 10)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
string.Format("&term={0}+{1:00}", string.Format("&term={0}+{1:00}",
searchTitle, searchTitle,
searchCriteria.AbsoluteEpisodeNumber))); searchCriteria.AbsoluteEpisodeNumber)));
@ -68,13 +68,13 @@ namespace NzbDrone.Core.Indexers.Nyaa
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.EpisodeQueryTitles) foreach (var queryTitle in searchCriteria.EpisodeQueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
string.Format("&term={0}", string.Format("&term={0}",
PrepareQuery(queryTitle)))); PrepareQuery(queryTitle))));
} }

View File

@ -17,22 +17,22 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
BaseUrl = "https://rss.omgwtfnzbs.org/rss-download.php"; BaseUrl = "https://rss.omgwtfnzbs.org/rss-download.php";
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(null)); pageableRequests.Add(GetPagedRequests(null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(string.Format("{0}+S{1:00}E{2:00}", pageableRequests.Add(GetPagedRequests(string.Format("{0}+S{1:00}E{2:00}",
queryTitle, queryTitle,
searchCriteria.SeasonNumber, searchCriteria.SeasonNumber,
searchCriteria.EpisodeNumber))); searchCriteria.EpisodeNumber)));
@ -41,13 +41,13 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(string.Format("{0}+S{1:00}", pageableRequests.Add(GetPagedRequests(string.Format("{0}+S{1:00}",
queryTitle, queryTitle,
searchCriteria.SeasonNumber))); searchCriteria.SeasonNumber)));
} }
@ -55,13 +55,13 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.QueryTitles) foreach (var queryTitle in searchCriteria.QueryTitles)
{ {
pageableRequests.AddIfNotNull(GetPagedRequests(string.Format("{0}+{1:yyyy MM dd}", pageableRequests.Add(GetPagedRequests(string.Format("{0}+{1:yyyy MM dd}",
queryTitle, queryTitle,
searchCriteria.AirDate))); searchCriteria.AirDate)));
} }
@ -69,21 +69,21 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
foreach (var queryTitle in searchCriteria.EpisodeQueryTitles) foreach (var queryTitle in searchCriteria.EpisodeQueryTitles)
{ {
var query = queryTitle.Replace('+', ' '); var query = queryTitle.Replace('+', ' ');
query = System.Web.HttpUtility.UrlEncode(query); query = System.Web.HttpUtility.UrlEncode(query);
pageableRequests.AddIfNotNull(GetPagedRequests(query)); pageableRequests.Add(GetPagedRequests(query));
} }
return pageableRequests; return pageableRequests;

View File

@ -17,50 +17,50 @@ namespace NzbDrone.Core.Indexers.Rarbg
_tokenProvider = tokenProvider; _tokenProvider = tokenProvider;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests("list", null, null)); pageableRequests.Add(GetPagedRequests("list", null, null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests("search", searchCriteria.Series.TvdbId, "S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber)); pageableRequests.Add(GetPagedRequests("search", searchCriteria.Series.TvdbId, "S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests("search", searchCriteria.Series.TvdbId, "S{0:00}", searchCriteria.SeasonNumber)); pageableRequests.Add(GetPagedRequests("search", searchCriteria.Series.TvdbId, "S{0:00}", searchCriteria.SeasonNumber));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests("search", searchCriteria.Series.TvdbId, "\"{0:yyyy MM dd}\"", searchCriteria.AirDate)); pageableRequests.Add(GetPagedRequests("search", searchCriteria.Series.TvdbId, "\"{0:yyyy MM dd}\"", searchCriteria.AirDate));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? tvdbId, string query, params object[] args) private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? tvdbId, string query, params object[] args)

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
@ -15,38 +16,38 @@ namespace NzbDrone.Core.Indexers
} }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(new[] { new IndexerRequest(_baseUrl, HttpAccept.Rss) }); pageableRequests.Add(new[] { new IndexerRequest(_baseUrl, HttpAccept.Rss) });
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
} }
} }

View File

@ -19,62 +19,64 @@ namespace NzbDrone.Core.Indexers.TitansOfTv
PageSize = 100; PageSize = 100;
} }
public IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages)); pageableRequests.Add(GetPagedRequests(MaxPages));
return pageableRequests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
series_id: searchCriteria.Series.TvdbId, series_id: searchCriteria.Series.TvdbId,
episode: string.Format("S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber))); episode: string.Format("S{0:00}E{1:00}", searchCriteria.SeasonNumber, searchCriteria.EpisodeNumber)));
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
series_id: searchCriteria.Series.TvdbId, series_id: searchCriteria.Series.TvdbId,
season: string.Format("Season {0:00}", searchCriteria.SeasonNumber))); season: string.Format("Season {0:00}", searchCriteria.SeasonNumber)));
return pageableRequests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(MaxPages,
series_id: searchCriteria.Series.TvdbId,
season: string.Format("Season {0:00}", searchCriteria.SeasonNumber)));
pageableRequests.AddTier();
// TODO: Search for all episodes?!? // TODO: Search for all episodes?!?
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages,
series_id: searchCriteria.Series.TvdbId,
season: string.Format("Season {0:00}", searchCriteria.SeasonNumber)));
return pageableRequests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
series_id: searchCriteria.Series.TvdbId, series_id: searchCriteria.Series.TvdbId,
air_date: searchCriteria.AirDate)); air_date: searchCriteria.AirDate));
return pageableRequests; return pageableRequests;
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, int? series_id = null, string episode = null, string season = null, DateTime? air_date = null) private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, int? series_id = null, string episode = null, string season = null, DateTime? air_date = null)

View File

@ -10,38 +10,38 @@ namespace NzbDrone.Core.Indexers.TorrentRss
{ {
public TorrentRssIndexerSettings Settings { get; set; } public TorrentRssIndexerSettings Settings { get; set; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetRssRequests(null)); pageableRequests.Add(GetRssRequests(null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters) private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters)

View File

@ -41,7 +41,7 @@ namespace NzbDrone.Core.Indexers.TorrentRss
_logger.Debug("Evaluating TorrentRss feed '{0}'", indexerSettings.BaseUrl); _logger.Debug("Evaluating TorrentRss feed '{0}'", indexerSettings.BaseUrl);
var requestGenerator = new TorrentRssIndexerRequestGenerator { Settings = indexerSettings }; var requestGenerator = new TorrentRssIndexerRequestGenerator { Settings = indexerSettings };
var request = requestGenerator.GetRecentRequests().First().First(); var request = requestGenerator.GetRecentRequests().GetAllTiers().First().First();
HttpResponse httpResponse = null; HttpResponse httpResponse = null;
try try

View File

@ -10,38 +10,38 @@ namespace NzbDrone.Core.Indexers.Torrentleech
{ {
public TorrentleechSettings Settings { get; set; } public TorrentleechSettings Settings { get; set; }
public virtual IList<IEnumerable<IndexerRequest>> GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
var pageableRequests = new List<IEnumerable<IndexerRequest>>(); var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.AddIfNotNull(GetRssRequests(null)); pageableRequests.Add(GetRssRequests(null));
return pageableRequests; return pageableRequests;
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SeasonSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(AnimeEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
public virtual IList<IEnumerable<IndexerRequest>> GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria) public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearchCriteria searchCriteria)
{ {
return new List<IEnumerable<IndexerRequest>>(); return new IndexerPageableRequestChain();
} }
private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters) private IEnumerable<IndexerRequest> GetRssRequests(string searchParameters)

View File

@ -503,6 +503,8 @@
<Compile Include="Indexers\IndexerBase.cs" /> <Compile Include="Indexers\IndexerBase.cs" />
<Compile Include="Indexers\IndexerDefinition.cs" /> <Compile Include="Indexers\IndexerDefinition.cs" />
<Compile Include="Indexers\IndexerFactory.cs" /> <Compile Include="Indexers\IndexerFactory.cs" />
<Compile Include="Indexers\IndexerPageableRequest.cs" />
<Compile Include="Indexers\IndexerPageableRequestChain.cs" />
<Compile Include="Indexers\IndexerStatusRepository.cs" /> <Compile Include="Indexers\IndexerStatusRepository.cs" />
<Compile Include="Indexers\IndexerRepository.cs" /> <Compile Include="Indexers\IndexerRepository.cs" />
<Compile Include="Indexers\IndexerRequest.cs" /> <Compile Include="Indexers\IndexerRequest.cs" />