Cleanup request paging code

pull/1479/head
Qstick 2 years ago
parent 24f6c937da
commit 712d95e6ce

@ -68,9 +68,9 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
{
var results = Subject.GetSearchRequests(new MovieSearchCriteria { Categories = new[] { NewznabStandardCategory.MoviesSD.Id, NewznabStandardCategory.MoviesDVD.Id } });
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("&category=1%2C2");
}
@ -81,9 +81,9 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
_movieSearchCriteria.ImdbId = "0076759";
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("type=imdb");
page.Url.Query.Should().Contain("query=tt0076759");
@ -96,9 +96,9 @@ namespace NzbDrone.Core.Test.IndexerTests.FileListTests
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("type=name");
page.Url.Query.Should().Contain("query=Star+Wars");

@ -76,9 +76,9 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
var results = Subject.GetSearchRequests(_movieSearchCriteria);
var imdbQuery = int.Parse(_movieSearchCriteria.ImdbId);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
@ -95,9 +95,9 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
var results = Subject.GetSearchRequests(_tvSearchSeasonEpisodeCriteria);
var tvdbQuery = _tvSearchSeasonEpisodeCriteria.TvdbId;
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);
@ -117,9 +117,9 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
var results = Subject.GetSearchRequests(_tvSearchDailyEpisodeCriteria);
var tvdbQuery = _tvSearchDailyEpisodeCriteria.TvdbId;
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
var encoding = HttpHeader.GetEncodingFromContentType(page.HttpRequest.Headers.ContentType);

@ -51,9 +51,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_movieSearchCriteria.Offset = 0;
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var pages = results.GetAllTiers().First().Take(3).ToList();
var pages = results.Take(3).ToList();
pages[0].Url.FullUri.Should().Contain("&offset=0");
}
@ -63,9 +63,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
{
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var pages = results.GetAllTiers().First().Take(500).ToList();
var pages = results.Take(500).ToList();
pages.Count.Should().BeLessThan(500);
}
@ -77,9 +77,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetAllTiers().Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().NotContain("imdbid=0076759");
page.Url.Query.Should().Contain("q=Star");
@ -92,9 +92,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("imdbid=0076759");
}
@ -106,9 +106,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.TmdbId };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("tmdbid=11");
}
@ -120,9 +120,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetAllTiers().First().First();
var page = results.First();
page.Url.Query.Should().Contain("tmdbid=11");
page.Url.Query.Should().NotContain("imdbid=0076759");
@ -136,9 +136,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetTier(0).First().First();
var page = results.First();
page.Url.Query.Should().Contain("tmdbid=11");
page.Url.Query.Should().Contain("imdbid=0076759");
@ -150,10 +150,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.Tiers.Should().Be(1);
results.GetTier(0).Should().HaveCount(1);
results.Should().HaveCount(1);
var page = results.GetTier(0).First().First();
var page = results.First();
page.Url.Query.Should().Contain("q=");
}
@ -167,7 +166,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
var results = Subject.GetSearchRequests(_movieSearchCriteria);
var page = results.GetTier(0).First().First();
var page = results.First();
page.Url.Query.Should().Contain("q=");
}
@ -178,9 +177,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.MovieSearchParams = new List<MovieSearchParam> { MovieSearchParam.Q, MovieSearchParam.ImdbId, MovieSearchParam.TmdbId };
var results = Subject.GetSearchRequests(_movieSearchCriteria);
results.Tiers.Should().Be(1);
results.Should().HaveCount(1);
var pageTier2 = results.GetTier(0).First().First();
var pageTier2 = results.First();
pageTier2.Url.Query.Should().NotContain("tmdbid=11");
pageTier2.Url.Query.Should().NotContain("imdbid=0076759");
@ -193,9 +192,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
_capabilities.TvSearchParams = new List<TvSearchParam> { TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep };
var results = Subject.GetSearchRequests(_tvSearchCriteria);
results.Tiers.Should().Be(1);
results.Should().HaveCount(1);
var pageTier = results.GetTier(0).First().First();
var pageTier = results.First();
pageTier.Url.Query.Should().Contain("season=00");
}

@ -15,12 +15,12 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public string SearchTerm { get; set; }
public int[] Categories { get; set; }
public string SearchType { get; set; }
public int? Limit { get; set; }
public int? Offset { get; set; }
public int Limit { get; set; }
public int Offset { get; set; }
public string Source { get; set; }
public string Host { get; set; }
public override string ToString() => $"{SearchQuery}, Offset: {Offset ?? 0}, Limit: {Limit ?? 0}, Categories: [{string.Join(", ", Categories)}]";
public override string ToString() => $"{SearchQuery}, Offset: {Offset}, Limit: {Limit}, Categories: [{string.Join(", ", Categories)}]";
public virtual string SearchQuery => $"Term: [{SearchTerm}]";

@ -138,8 +138,8 @@ namespace NzbDrone.Core.IndexerSearch
spec.SearchTerm = query.q;
spec.SearchType = query.t;
spec.Limit = query.limit;
spec.Offset = query.offset;
spec.Limit = query.limit ?? 100;
spec.Offset = query.offset ?? 0;
spec.Source = query.source;
spec.Host = query.host;

@ -100,45 +100,29 @@ namespace NzbDrone.Core.Indexers.Definitions
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)

@ -194,49 +194,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}");
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -107,34 +107,30 @@ namespace NzbDrone.Core.Indexers.Definitions
{
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
=> GetRequestWithSearchType(searchCriteria, "anime");
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
=> GetRequestWithSearchType(searchCriteria, "music");
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
=> GetRequestWithSearchType(searchCriteria, "anime");
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
=> GetRequestWithSearchType(searchCriteria, "anime");
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
=> GetRequestWithSearchType(searchCriteria, "anime");
private IndexerPageableRequestChain GetRequestWithSearchType(SearchCriteriaBase searchCriteria, string searchType)
private IEnumerable<IndexerRequest> GetRequestWithSearchType(SearchCriteriaBase searchCriteria, string searchType)
{
var pageableRequests = new IndexerPageableRequestChain();
// TODO: Remove this once Prowlarr has proper support for non Pageable Indexers and can tell Sonarr that indexer doesn't support pagination in a proper way, for now just return empty release list on all request containing an offset
if (searchCriteria.Offset is > 0)
{
return pageableRequests;
return new List<IndexerRequest>();
}
pageableRequests.Add(GetRequest(searchType, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetRequest(searchType, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetRequest(string searchType, string term, int[] categories)

@ -164,49 +164,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -99,43 +99,31 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return new IndexerRequest(requestUrl, HttpAccept.Html);
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}");
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
// Animedia doesn't support music, but this function required by interface
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
// Animedia doesn't support books, but this function required by interface
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -146,45 +146,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -192,37 +192,29 @@ public class AudioBookBayRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term)

@ -76,7 +76,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre);
@ -93,23 +93,19 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim());
}
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.Categories, null);
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim());
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.Categories, searchCriteria.Genre);
@ -128,12 +124,10 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedTvSearchString).Trim());
}
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
throw new NotImplementedException();
}
@ -141,15 +135,13 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
// hook to adjust the search term
protected virtual string GetSearchTerm(string term) => term;
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.Categories, null);
parameters.Add("search", GetSearchTerm(searchCriteria.SanitizedSearchTerm).Trim());
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
}
}

@ -177,49 +177,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -178,49 +178,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm)));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm)));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm)));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm)));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm)));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -120,49 +120,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return indexerRequest;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId, searchCriteria.TmdbId.GetValueOrDefault()));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId, searchCriteria.TmdbId.GetValueOrDefault());
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -90,7 +90,7 @@ namespace NzbDrone.Core.Indexers.Definitions
{ "adv_sort", "date" },
{ "q", term },
{ "m", searchCriteria.Offset.ToString() },
{ "max", searchCriteria.Limit?.ToString() ?? "100" }
{ "max", searchCriteria.Limit.ToString() ?? "100" }
};
var searchUrl = string.Format("{0}/?{1}", Settings.BaseUrl.TrimEnd('/'), qc.GetQueryString());
@ -100,49 +100,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -129,49 +129,29 @@ namespace NzbDrone.Core.Indexers.Definitions
}
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -34,31 +34,29 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
yield return new IndexerRequest(builder.Build());
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery();
var searchString = searchCriteria.SearchTerm != null ? searchCriteria.SearchTerm : "";
var btnResults = searchCriteria.Limit.GetValueOrDefault();
var btnResults = searchCriteria.Limit;
if (btnResults == 0)
{
btnResults = (int)Capabilities.LimitsDefault;
}
var btnOffset = searchCriteria.Offset.GetValueOrDefault();
var btnOffset = searchCriteria.Offset;
if (searchCriteria.TvdbId > 0)
{
@ -93,25 +91,21 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
// Neither a season only search nor daily nor standard, fall back to query
parameters.Search = searchString.Replace(" ", "%");
pageableRequests.Add(GetPagedRequests(parameters, btnResults, btnOffset));
return pageableRequests;
return GetPagedRequests(parameters, btnResults, btnOffset);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new BroadcastheNetTorrentQuery();
var searchString = searchCriteria.SearchTerm != null ? searchCriteria.SearchTerm : "";
var btnResults = searchCriteria.Limit.GetValueOrDefault();
var btnResults = searchCriteria.Limit;
if (btnResults == 0)
{
btnResults = (int)Capabilities.LimitsDefault;
@ -119,11 +113,9 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
parameters.Search = searchString.Replace(" ", "%");
var btnOffset = searchCriteria.Offset.GetValueOrDefault();
pageableRequests.Add(GetPagedRequests(parameters, btnResults, btnOffset));
var btnOffset = searchCriteria.Offset;
return pageableRequests;
return GetPagedRequests(parameters, btnResults, btnOffset);
}
}
}

@ -42,12 +42,10 @@ namespace NzbDrone.Core.Indexers.Cardigann
public Func<IDictionary<string, string>> GetCookies { get; set; }
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
_logger.Trace("Getting Movie search");
var pageableRequests = new IndexerPageableRequestChain();
var variables = GetQueryVariableDefaults(searchCriteria);
variables[".Query.Movie"] = null;
@ -59,17 +57,13 @@ namespace NzbDrone.Core.Indexers.Cardigann
variables[".Query.TraktID"] = searchCriteria.TraktId?.ToString() ?? null;
variables[".Query.DoubanID"] = searchCriteria.DoubanId?.ToString() ?? null;
pageableRequests.Add(GetRequest(variables, searchCriteria));
return pageableRequests;
return GetRequest(variables, searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
_logger.Trace("Getting Music search");
var pageableRequests = new IndexerPageableRequestChain();
var variables = GetQueryVariableDefaults(searchCriteria);
variables[".Query.Album"] = searchCriteria.Album;
@ -79,17 +73,13 @@ namespace NzbDrone.Core.Indexers.Cardigann
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
variables[".Query.Track"] = searchCriteria.Track;
pageableRequests.Add(GetRequest(variables, searchCriteria));
return pageableRequests;
return GetRequest(variables, searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
_logger.Trace("Getting TV search");
var pageableRequests = new IndexerPageableRequestChain();
var variables = GetQueryVariableDefaults(searchCriteria);
variables[".Query.Series"] = null;
@ -107,17 +97,13 @@ namespace NzbDrone.Core.Indexers.Cardigann
variables[".Query.DoubanID"] = searchCriteria.DoubanId?.ToString() ?? null;
variables[".Query.Episode"] = searchCriteria.EpisodeSearchString;
pageableRequests.Add(GetRequest(variables, searchCriteria));
return pageableRequests;
return GetRequest(variables, searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
_logger.Trace("Getting Book search");
var pageableRequests = new IndexerPageableRequestChain();
var variables = GetQueryVariableDefaults(searchCriteria);
variables[".Query.Author"] = searchCriteria.Author;
@ -126,22 +112,16 @@ namespace NzbDrone.Core.Indexers.Cardigann
variables[".Query.Publisher"] = searchCriteria.Publisher;
variables[".Query.Year"] = searchCriteria.Year?.ToString() ?? null;
pageableRequests.Add(GetRequest(variables, searchCriteria));
return pageableRequests;
return GetRequest(variables, searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
_logger.Trace("Getting Basic search");
var pageableRequests = new IndexerPageableRequestChain();
var variables = GetQueryVariableDefaults(searchCriteria);
pageableRequests.Add(GetRequest(variables, searchCriteria));
return pageableRequests;
return GetRequest(variables, searchCriteria);
}
private Dictionary<string, object> GetQueryVariableDefaults(SearchCriteriaBase searchCriteria)
@ -151,8 +131,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
variables[".Query.Type"] = searchCriteria.SearchType;
variables[".Query.Q"] = searchCriteria.SearchTerm;
variables[".Query.Categories"] = searchCriteria.Categories;
variables[".Query.Limit"] = searchCriteria.Limit?.ToString() ?? null;
variables[".Query.Offset"] = searchCriteria.Offset?.ToString() ?? null;
variables[".Query.Limit"] = searchCriteria.Limit.ToString() ?? null;
variables[".Query.Offset"] = searchCriteria.Offset.ToString() ?? null;
variables[".Query.Extended"] = null;
variables[".Query.APIKey"] = null;
variables[".Query.Genre"] = null;
@ -1017,8 +997,8 @@ namespace NzbDrone.Core.Indexers.Cardigann
private IEnumerable<IndexerRequest> GetRequest(Dictionary<string, object> variables, SearchCriteriaBase searchCriteria)
{
var limit = searchCriteria.Limit ?? 100;
var offset = searchCriteria.Offset ?? 0;
var limit = searchCriteria.Limit;
var offset = searchCriteria.Offset;
if (offset > 0 && limit > 0 && offset / limit > 0)
{

@ -16,9 +16,8 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
public Func<IDictionary<string, string>> GetCookies { get; set; }
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace() || searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
@ -47,14 +46,11 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
@ -70,14 +66,11 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
parameters.Set("query", searchCriteria.SanitizedSearchTerm.Trim());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
@ -87,14 +80,11 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
parameters.Set("query", searchCriteria.SanitizedSearchTerm.Trim());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
@ -104,14 +94,11 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
parameters.Set("query", searchCriteria.SanitizedSearchTerm.Trim());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.SearchTerm.IsNotNullOrWhiteSpace())
@ -121,9 +108,7 @@ public class FileListRequestGenerator : IIndexerRequestGenerator
parameters.Set("query", searchCriteria.SanitizedSearchTerm.Trim());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)

@ -137,49 +137,29 @@ public class FunFileRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, string imdbId = null)

@ -42,10 +42,8 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
yield return request;
}
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public virtual IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
if (searchCriteria.ImdbId != null)
@ -53,15 +51,11 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
parameters.Set(ImdbInTags ? "taglist" : "cataloguenumber", searchCriteria.FullImdbId);
}
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
@ -79,15 +73,11 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
parameters.Set("recordlabel", searchCriteria.Label);
}
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedTvSearchString, searchCriteria.Categories);
if (searchCriteria.ImdbId != null)
@ -95,29 +85,21 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator
parameters.Set(ImdbInTags ? "taglist" : "cataloguenumber", searchCriteria.FullImdbId);
}
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
// hook to adjust the search term

@ -203,49 +203,29 @@ namespace NzbDrone.Core.Indexers.Definitions
{
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)));
return pageableRequests;
return GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)));
return pageableRequests;
return GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)));
return pageableRequests;
return GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)));
return pageableRequests;
return GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)));
return pageableRequests;
return GetRequest(GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
}
public void FetchPasskey()

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
@ -75,7 +75,7 @@ public class GreatPosterWallRequestGenerator : GazelleRequestGenerator
_settings = settings;
}
public override IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public override IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SearchTerm, searchCriteria.Categories);
@ -84,9 +84,7 @@ public class GreatPosterWallRequestGenerator : GazelleRequestGenerator
parameters.Set("searchstr", searchCriteria.FullImdbId);
}
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
protected override NameValueCollection GetBasicSearchParameters(string term, int[] categories)

@ -16,9 +16,8 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
public IndexerCapabilities Capabilities { get; set; }
public HDBitsSettings Settings { get; set; }
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public virtual IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var query = new TorrentQuery();
var imdbId = ParseUtil.GetImdbID(searchCriteria.ImdbId).GetValueOrDefault(0);
@ -38,9 +37,7 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
query.ImdbInfo.Id = imdbId;
}
pageableRequests.Add(GetRequest(query));
return pageableRequests;
return GetRequest(query);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }
@ -68,14 +65,13 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
yield return new IndexerRequest(request);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var query = new TorrentQuery();
var tvdbId = searchCriteria.TvdbId.GetValueOrDefault(0);
var imdbId = ParseUtil.GetImdbID(searchCriteria.ImdbId).GetValueOrDefault(0);
@ -112,19 +108,16 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
query.ImdbInfo.Id = imdbId;
}
pageableRequests.Add(GetRequest(query));
return pageableRequests;
return GetRequest(query);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var query = new TorrentQuery();
if (searchCriteria.Categories?.Length > 0)
@ -137,9 +130,7 @@ namespace NzbDrone.Core.Indexers.Definitions.HDBits
query.Search = searchCriteria.SanitizedSearchTerm;
}
pageableRequests.Add(GetRequest(query));
return pageableRequests;
return GetRequest(query);
}
}
}

@ -178,45 +178,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.ImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.ImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.ImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.ImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -166,49 +166,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -25,18 +25,15 @@ namespace NzbDrone.Core.Indexers.Headphones
PageSize = 100;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var capabilities = Capabilities;
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && capabilities.MusicSearchArtistAvailable)
@ -67,30 +64,22 @@ namespace NzbDrone.Core.Indexers.Headphones
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria,
parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var capabilities = Capabilities;
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
@ -99,9 +88,7 @@ namespace NzbDrone.Core.Indexers.Headphones
parameters.Add("q", NewsnabifyTitle(searchCriteria.SearchTerm));
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
@ -120,15 +107,9 @@ namespace NzbDrone.Core.Indexers.Headphones
baseUrl += "&apikey=" + Settings.ApiKey;
}
if (searchCriteria.Limit.HasValue)
{
parameters.Add("limit", searchCriteria.Limit.ToString());
}
parameters.Add("limit", searchCriteria.Limit.ToString());
if (searchCriteria.Offset.HasValue)
{
parameters.Add("offset", searchCriteria.Offset.ToString());
}
parameters.Add("offset", searchCriteria.Offset.ToString());
var request = new IndexerRequest(string.Format("{0}&{1}", baseUrl, parameters.GetQueryString()), HttpAccept.Rss);
request.HttpRequest.Credentials = new BasicNetworkCredential(Settings.Username, Settings.Password);

@ -212,49 +212,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -166,49 +166,29 @@ namespace NzbDrone.Core.Indexers.Definitions
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)

@ -123,9 +123,8 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
@ -157,34 +156,29 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
parameters.Set("tags_type", "0");
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
@ -206,7 +200,7 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator
queryCats.ForEach(cat => parameters.Set($"filter_cat[{cat}]", "1"));
}
if (searchCriteria.Offset.HasValue && searchCriteria.Limit.HasValue && searchCriteria.Offset > 0 && searchCriteria.Limit > 0)
if (searchCriteria.Offset > 0 && searchCriteria.Limit > 0)
{
var page = (int)(searchCriteria.Offset / searchCriteria.Limit) + 1;
parameters.Set("page", page.ToString());

@ -90,28 +90,26 @@ public class MoreThanTVRequestGenerator : IIndexerRequestGenerator
};
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
=> PerformRequest(searchCriteria);
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
=> PerformRequest(searchCriteria);
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
=> PerformRequest(searchCriteria);
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
=> PerformRequest(searchCriteria);
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
=> PerformRequest(searchCriteria);
public Func<IDictionary<string, string>> GetCookies { get; set; }
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
private IndexerPageableRequestChain PerformRequest(SearchCriteriaBase query)
private IEnumerable<IndexerRequest> PerformRequest(SearchCriteriaBase query)
{
var chain = new IndexerPageableRequestChain();
var requests = new List<IndexerRequest> { new (new HttpRequest(GetTorrentSearchUrl(query)) { Headers = new HttpHeader(BrowserHeaders), AllowAutoRedirect = true }) };
if (query is TvSearchCriteria tvSearchCriteria)
@ -127,9 +125,7 @@ public class MoreThanTVRequestGenerator : IIndexerRequestGenerator
}
}
chain.Add(requests);
return chain;
return requests;
}
private string GetTorrentSearchUrl(SearchCriteriaBase query, string overrideSearchTerm = null)

@ -236,8 +236,8 @@ namespace NzbDrone.Core.Indexers.Definitions
{ "tor[srchIn][narrator]", "true" },
{ "tor[searchIn]", "torrents" },
{ "tor[sortType]", "default" },
{ "tor[perpage]", searchCriteria.Limit?.ToString() ?? "100" },
{ "tor[startNumber]", searchCriteria.Offset?.ToString() ?? "0" },
{ "tor[perpage]", searchCriteria.Limit.ToString() },
{ "tor[startNumber]", searchCriteria.Offset.ToString() },
{ "thumbnails", "1" }, // gives links for thumbnail sized versions of their posters
{ "description", "1" } // include the description
};
@ -284,37 +284,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria));
return pageableRequests;
return GetPagedRequests(searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria));
return pageableRequests;
return GetPagedRequests(searchCriteria);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -98,20 +98,18 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return new IndexerRequest(builder.Build());
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var queryParams = new NebulanceQuery
{
Age = ">0"
@ -141,20 +139,16 @@ namespace NzbDrone.Core.Indexers.Definitions
}
}
pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset));
return pageableRequests;
return GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var queryParams = new NebulanceQuery
{
Age = ">0"
@ -165,9 +159,7 @@ namespace NzbDrone.Core.Indexers.Definitions
queryParams.Name = "%" + Regex.Replace(searchCriteria.SanitizedSearchTerm, @"[ -._]+", "%").Trim() + "%";
}
pageableRequests.Add(GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset));
return pageableRequests;
return GetPagedRequests(queryParams, searchCriteria.Limit, searchCriteria.Offset);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -26,11 +26,10 @@ namespace NzbDrone.Core.Indexers.Newznab
PageSize = 100;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings, Definition);
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.TmdbId.HasValue && capabilities.MovieSearchTmdbAvailable)
@ -66,18 +65,13 @@ namespace NzbDrone.Core.Indexers.Newznab
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria,
capabilities,
parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, capabilities, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings, Definition);
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && capabilities.MusicSearchArtistAvailable)
@ -108,18 +102,13 @@ namespace NzbDrone.Core.Indexers.Newznab
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria,
capabilities,
parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, capabilities, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings, Definition);
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.TvdbId.HasValue && capabilities.TvSearchTvdbAvailable)
@ -175,18 +164,13 @@ namespace NzbDrone.Core.Indexers.Newznab
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria,
capabilities,
parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, capabilities, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings, Definition);
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Author.IsNotNullOrWhiteSpace() && capabilities.BookSearchAuthorAvailable)
@ -217,17 +201,12 @@ namespace NzbDrone.Core.Indexers.Newznab
}
}
pageableRequests.Add(GetPagedRequests(searchCriteria,
capabilities,
parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, capabilities, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings, Definition);
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
@ -236,9 +215,7 @@ namespace NzbDrone.Core.Indexers.Newznab
parameters.Set("q", NewsnabifyTitle(searchCriteria.SearchTerm));
}
pageableRequests.Add(GetPagedRequests(searchCriteria, capabilities, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, capabilities, parameters);
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, IndexerCapabilities capabilities, NameValueCollection parameters)
@ -262,15 +239,9 @@ namespace NzbDrone.Core.Indexers.Newznab
searchUrl += "&apikey=" + Settings.ApiKey;
}
if (searchCriteria.Limit.HasValue)
{
parameters.Set("limit", searchCriteria.Limit.ToString());
}
parameters.Set("limit", searchCriteria.Limit.ToString());
if (searchCriteria.Offset.HasValue)
{
parameters.Set("offset", searchCriteria.Offset.ToString());
}
parameters.Set("offset", searchCriteria.Offset.ToString());
if (parameters.Count > 0)
{

@ -199,49 +199,29 @@ public class NorBitsRequestGenerator : IIndexerRequestGenerator
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -1054,49 +1054,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit ?? 100, searchCriteria.Offset ?? 0));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -132,9 +132,8 @@ namespace NzbDrone.Core.Indexers.Definitions
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
@ -152,39 +151,31 @@ namespace NzbDrone.Core.Indexers.Definitions
parameters.Set("year", searchCriteria.Year.ToString());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)

@ -18,20 +18,14 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
public IIndexerHttpClient HttpClient { get; set; }
public Logger Logger { get; set; }
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
if (searchCriteria.ImdbId.IsNotNullOrWhiteSpace())
{
pageableRequests.Add(GetRequest(searchCriteria.FullImdbId));
}
else
{
pageableRequests.Add(GetRequest(string.Format("{0}", searchCriteria.SearchTerm)));
return GetRequest(searchCriteria.FullImdbId);
}
return pageableRequests;
return GetRequest(string.Format("{0}", searchCriteria.SearchTerm));
}
public Func<IDictionary<string, string>> GetCookies { get; set; }
@ -72,28 +66,24 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(string.Format("{0}", searchCriteria.SearchTerm)));
return pageableRequests;
return GetRequest(string.Format("{0}", searchCriteria.SearchTerm));
}
}
}

@ -135,37 +135,29 @@ public class PirateTheNetRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, string imdbId = null)

@ -269,49 +269,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -276,49 +276,29 @@ public class PreToMeRequestGenerator : IIndexerRequestGenerator
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -78,40 +78,29 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg
yield return new IndexerRequest(requestBuilder.Build());
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories, searchCriteria.FullImdbId, searchCriteria.TmdbId));
return pageableRequests;
return GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories, searchCriteria.FullImdbId, searchCriteria.TmdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedTvSearchString, searchCriteria.Categories, searchCriteria.FullImdbId, tvdbId: searchCriteria.TvdbId));
return pageableRequests;
return GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedTvSearchString, searchCriteria.Categories, searchCriteria.FullImdbId, tvdbId: searchCriteria.TvdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetRequest(searchCriteria.IsRssSearch, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -104,9 +104,8 @@ namespace NzbDrone.Core.Indexers.Definitions
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
@ -124,39 +123,31 @@ namespace NzbDrone.Core.Indexers.Definitions
parameters.Set("year", searchCriteria.Year.ToString());
}
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var parameters = new NameValueCollection();
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
return pageableRequests;
return GetPagedRequests(searchCriteria, parameters);
}
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)

@ -185,49 +185,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -1506,54 +1506,34 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
if (searchCriteria.Season == null)
{
searchCriteria.Season = 0;
}
pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -120,49 +120,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -141,49 +141,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -124,37 +124,29 @@ public class ShazbatRequestGenerator : IIndexerRequestGenerator
_settings = settings;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}");
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term)

@ -129,43 +129,31 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
// Shizaproject doesn't support music, but this function required by interface
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
// Shizaproject doesn't support books, but this function required by interface
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -140,38 +140,34 @@ namespace NzbDrone.Core.Indexers.Definitions
_pageSize = pageSize;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return GetSearch(searchCriteria, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return GetSearch(searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return GetSearch(searchCriteria, searchCriteria.FullImdbId, searchCriteria.Season, searchCriteria.Episode);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return GetSearch(searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
return GetSearch(searchCriteria);
}
private IndexerPageableRequestChain GetSearch(SearchCriteriaBase searchCriteria, string imdbId = null, int? season = null, string episode = null)
private IEnumerable<IndexerRequest> GetSearch(SearchCriteriaBase searchCriteria, string imdbId = null, int? season = null, string episode = null)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.Limit ?? _pageSize, searchCriteria.Offset ?? 0, imdbId, season, episode));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories, searchCriteria.Limit, searchCriteria.Offset, imdbId, season, episode);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, int limit, int offset, string imdbId = null, int? season = null, string episode = null)

@ -225,10 +225,8 @@ public class SpeedCDRequestGenerator : IIndexerRequestGenerator
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var term = $"{searchCriteria.SanitizedSearchTerm}";
if (searchCriteria.FullImdbId.IsNotNullOrWhiteSpace())
@ -236,24 +234,16 @@ public class SpeedCDRequestGenerator : IIndexerRequestGenerator
term = $"{searchCriteria.FullImdbId}";
}
pageableRequests.Add(GetPagedRequests(term.Trim(), searchCriteria.Categories, searchCriteria.FullImdbId.IsNotNullOrWhiteSpace()));
return pageableRequests;
return GetPagedRequests(term.Trim(), searchCriteria.Categories, searchCriteria.FullImdbId.IsNotNullOrWhiteSpace());
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var term = $"{searchCriteria.SanitizedTvSearchString}";
if (searchCriteria.FullImdbId.IsNotNullOrWhiteSpace())
@ -271,27 +261,17 @@ public class SpeedCDRequestGenerator : IIndexerRequestGenerator
}
}
pageableRequests.Add(GetPagedRequests(term.Trim(), searchCriteria.Categories, searchCriteria.FullImdbId.IsNotNullOrWhiteSpace()));
return pageableRequests;
return GetPagedRequests(term.Trim(), searchCriteria.Categories, searchCriteria.FullImdbId.IsNotNullOrWhiteSpace());
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -111,47 +111,33 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(searchCriteria.IsRssSearch
return searchCriteria.IsRssSearch
? GetRssRequest()
: GetSearchRequests(searchCriteria.SanitizedTvSearchString));
return pageableRequests;
: GetSearchRequests(searchCriteria.SanitizedTvSearchString);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(searchCriteria.IsRssSearch
return searchCriteria.IsRssSearch
? GetRssRequest()
: GetSearchRequests(searchCriteria.SanitizedSearchTerm));
return pageableRequests;
: GetSearchRequests(searchCriteria.SanitizedSearchTerm);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -160,41 +160,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
private string StripSearchString(string term)

@ -262,28 +262,18 @@ namespace NzbDrone.Core.Indexers.Definitions
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var term = $"{searchCriteria.SanitizedSearchTerm}";
if (searchCriteria.Season is > 0)
@ -291,27 +281,17 @@ namespace NzbDrone.Core.Indexers.Definitions
term += $" Сезон {searchCriteria.Season}";
}
pageableRequests.Add(GetPagedRequests(term, searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(term, searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)

@ -183,47 +183,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
return pageableRequests;
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -167,49 +167,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.FullImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -14,13 +14,9 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
{
}
public virtual IndexerPageableRequestChain GetRecentRequests()
public virtual IEnumerable<IndexerRequest> GetRecentRequests()
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests("list", null, null));
return pageableRequests;
return GetPagedRequests("list", null, null);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? tvdbId, string query, params object[] args)
@ -72,31 +68,29 @@ namespace NzbDrone.Core.Indexers.TorrentPotato
yield return new IndexerRequest(requestBuilder.Build());
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetMovieRequest(searchCriteria));
return pageableRequests;
return GetMovieRequest(searchCriteria);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -162,49 +162,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.ImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories, searchCriteria.ImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.ImdbId));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories, searchCriteria.ImdbId);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -95,41 +95,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -22,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D
public Func<IDictionary<string, string>> GetCookies { get; set; }
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
@ -38,21 +38,17 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D
parameters.Add("tmdbId", searchCriteria.TmdbId.ToString());
}
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedTvSearchString, searchCriteria.Categories);
@ -68,27 +64,21 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D
parameters.Add("tvdbId", searchCriteria.TvdbId.ToString());
}
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var parameters = GetBasicSearchParameters(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories);
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetRequest(parameters));
return pageableRequests;
return GetRequest(parameters);
}
private IEnumerable<IndexerRequest> GetRequest(List<KeyValuePair<string, string>> searchParameters)

@ -154,49 +154,29 @@ public class UniotakuRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)

@ -173,49 +173,29 @@ public class XSpeedsRequestGenerator : IIndexerRequestGenerator
_capabilities = capabilities;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedTvSearchString}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories);
}
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories)

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text.RegularExpressions;
@ -83,21 +83,19 @@ namespace NzbDrone.Core.Indexers.Definitions.Xthor
yield return request;
}
public IndexerPageableRequestChain GetSearchRequestsCommon(SearchCriteriaBase searchCriteria,
string searchTerm,
string tmdbid = null)
public IEnumerable<IndexerRequest> GetSearchRequestsCommon(SearchCriteriaBase searchCriteria, string searchTerm, string tmdbid = null)
{
var pageableRequests = new IndexerPageableRequestChain();
var actualPage = 0;
var requests = new List<IndexerRequest>();
while (actualPage < Settings.MaxPages)
{
pageableRequests.Add(GetPagedRequests(searchTerm, searchCriteria.Categories, actualPage, tmdbid));
requests.AddRange(GetPagedRequests(searchTerm, searchCriteria.Categories, actualPage, tmdbid));
if (Settings.EnhancedFrenchAccent && (Settings.Accent == 1 || Settings.Accent == 2))
{
pageableRequests.Add(
GetPagedRequests(searchTerm, searchCriteria.Categories, actualPage, tmdbid, 47));
requests.AddRange(GetPagedRequests(searchTerm, searchCriteria.Categories, actualPage, tmdbid, 47));
}
if (tmdbid.IsNotNullOrWhiteSpace() && Settings.ByPassPageForTmDbid)
@ -108,33 +106,33 @@ namespace NzbDrone.Core.Indexers.Definitions.Xthor
++actualPage;
}
return pageableRequests;
return requests;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return GetSearchRequestsCommon(searchCriteria,
string.Format("{0}", searchCriteria.SanitizedSearchTerm),
searchCriteria.TmdbId.ToString());
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return GetSearchRequestsCommon(searchCriteria,
string.Format("{0}", searchCriteria.SanitizedTvSearchString));
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm));
}

@ -251,49 +251,29 @@ namespace NzbDrone.Core.Indexers.Definitions
yield return request;
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedTvSearchString), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories));
return pageableRequests;
return GetPagedRequests(string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.Categories);
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

@ -233,7 +233,7 @@ namespace NzbDrone.Core.Indexers
_indexerStatusService.UpdateCookies(Definition.Id, cookies, expiration);
}
protected virtual async Task<IndexerPageableQueryResult> FetchReleases(Func<IIndexerRequestGenerator, IndexerPageableRequestChain> pageableRequestChainSelector, SearchCriteriaBase searchCriteria, bool isRecent = false)
protected virtual async Task<IndexerPageableQueryResult> FetchReleases(Func<IIndexerRequestGenerator, IEnumerable<IndexerRequest>> pageableRequestChainSelector, SearchCriteriaBase searchCriteria, bool isRecent = false)
{
var releases = new List<ReleaseInfo>();
var result = new IndexerPageableQueryResult();
@ -250,41 +250,19 @@ namespace NzbDrone.Core.Indexers
var pageableRequestChain = pageableRequestChainSelector(generator);
for (int i = 0; i < pageableRequestChain.Tiers; i++)
foreach (var pageableRequest in pageableRequestChain)
{
var pageableRequests = pageableRequestChain.GetTier(i);
var pageSize = PageSize;
foreach (var pageableRequest in pageableRequests)
{
var pagedReleases = new List<ReleaseInfo>();
url = pageableRequest.Url.FullUri;
var pageSize = PageSize;
var page = await FetchPage(pageableRequest, parser);
foreach (var request in pageableRequest)
{
url = request.Url.FullUri;
pageSize = pageSize == 1 ? page.Releases.Count : pageSize;
var page = await FetchPage(request, parser);
result.Queries.Add(page);
pageSize = pageSize == 1 ? page.Releases.Count : pageSize;
result.Queries.Add(page);
pagedReleases.AddRange(page.Releases);
if (!IsFullPage(page.Releases, pageSize))
{
break;
}
}
releases.AddRange(pagedReleases);
}
if (releases.Any())
{
break;
}
releases.AddRange(page.Releases);
}
_indexerStatusService.RecordSuccess(Definition.Id);
@ -377,11 +355,6 @@ namespace NzbDrone.Core.Indexers
return Capabilities ?? ((IndexerDefinition)Definition).Capabilities;
}
protected virtual bool IsFullPage(IList<ReleaseInfo> page, int pageSize)
{
return pageSize != 0 && page.Count >= pageSize;
}
protected virtual async Task<IndexerQueryResult> FetchPage(IndexerRequest request, IParseIndexerResponse parser)
{
var response = await FetchIndexerResponse(request);
@ -549,7 +522,7 @@ namespace NzbDrone.Core.Indexers
testCriteria.SearchTerm = "test";
}
var firstRequest = generator.GetSearchRequests(testCriteria).GetAllTiers().FirstOrDefault()?.FirstOrDefault();
var firstRequest = generator.GetSearchRequests(testCriteria).FirstOrDefault();
if (firstRequest == null)
{

@ -6,11 +6,11 @@ namespace NzbDrone.Core.Indexers
{
public interface IIndexerRequestGenerator
{
IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria);
IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria);
IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria);
IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria);
IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria);
IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria);
IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria);
Func<IDictionary<string, string>> GetCookies { get; set; }
Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
}

@ -1,25 +0,0 @@
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();
}
}
}

@ -1,54 +0,0 @@
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 => _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>());
}
}
}

@ -14,38 +14,34 @@ namespace NzbDrone.Core.Indexers
_baseUrl = baseUrl;
}
public virtual IndexerPageableRequestChain GetRecentRequests()
public virtual IEnumerable<IndexerRequest> GetRecentRequests()
{
var pageableRequests = new IndexerPageableRequestChain();
pageableRequests.Add(new[] { new IndexerRequest(_baseUrl, HttpAccept.Rss) });
return pageableRequests;
return new[] { new IndexerRequest(_baseUrl, HttpAccept.Rss) };
}
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public virtual IEnumerable<IndexerRequest> GetSearchRequests(MovieSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(MusicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(TvSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BookSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria)
public IEnumerable<IndexerRequest> GetSearchRequests(BasicSearchCriteria searchCriteria)
{
return new IndexerPageableRequestChain();
return new List<IndexerRequest>();
}
public Func<IDictionary<string, string>> GetCookies { get; set; }

Loading…
Cancel
Save