diff --git a/src/NzbDrone.Core.Test/IndexerTests/FileListTests/FileListRequestGeneratorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/FileListTests/FileListRequestGeneratorFixture.cs index 3003ff6ac..8e6b55fb6 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/FileListTests/FileListRequestGeneratorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/FileListTests/FileListRequestGeneratorFixture.cs @@ -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"); diff --git a/src/NzbDrone.Core.Test/IndexerTests/HDBitsTests/HDBitsRequestGeneratorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/HDBitsTests/HDBitsRequestGeneratorFixture.cs index 1327b675b..5cf6dbab0 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/HDBitsTests/HDBitsRequestGeneratorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/HDBitsTests/HDBitsRequestGeneratorFixture.cs @@ -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); diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs index ead7db168..626b441f9 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs @@ -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.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.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.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.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.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.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.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"); } diff --git a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs index 339abff86..704321bed 100644 --- a/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs +++ b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs @@ -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}]"; diff --git a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs index a760bebba..7ac75ab22 100644 --- a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs @@ -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; diff --git a/src/NzbDrone.Core/Indexers/Definitions/Anidex.cs b/src/NzbDrone.Core/Indexers/Definitions/Anidex.cs index cb5b934fc..775267044 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Anidex.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Anidex.cs @@ -100,45 +100,29 @@ namespace NzbDrone.Core.Indexers.Definitions _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Anidub.cs b/src/NzbDrone.Core/Indexers/Definitions/Anidub.cs index b52d11b3c..98952d600 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Anidub.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Anidub.cs @@ -194,49 +194,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}")); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs index 804cfe848..6e2282b6a 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs @@ -107,34 +107,30 @@ namespace NzbDrone.Core.Indexers.Definitions { } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) => GetRequestWithSearchType(searchCriteria, "anime"); - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) => GetRequestWithSearchType(searchCriteria, "music"); - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) => GetRequestWithSearchType(searchCriteria, "anime"); - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) => GetRequestWithSearchType(searchCriteria, "anime"); - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) => GetRequestWithSearchType(searchCriteria, "anime"); - private IndexerPageableRequestChain GetRequestWithSearchType(SearchCriteriaBase searchCriteria, string searchType) + private IEnumerable 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(); } - pageableRequests.Add(GetRequest(searchType, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)); - - return pageableRequests; + return GetRequest(searchType, searchCriteria.SanitizedSearchTerm, searchCriteria.Categories); } private IEnumerable GetRequest(string searchType, string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs index 8c1557c7b..a5877d0bb 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs @@ -164,49 +164,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Animedia.cs b/src/NzbDrone.Core/Indexers/Definitions/Animedia.cs index eabb933e7..f752cda3b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Animedia.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Animedia.cs @@ -99,43 +99,31 @@ namespace NzbDrone.Core.Indexers.Definitions yield return new IndexerRequest(requestUrl, HttpAccept.Html); } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } // Animedia doesn't support books, but this function required by interface - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs b/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs index f49041e6b..2a18b409f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs @@ -146,45 +146,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/AudioBookBay.cs b/src/NzbDrone.Core/Indexers/Definitions/AudioBookBay.cs index 2c0b7eba4..3cf5ff341 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AudioBookBay.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AudioBookBay.cs @@ -192,37 +192,29 @@ public class AudioBookBayRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}")); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"); } private IEnumerable GetPagedRequests(string term) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs index dfa9fc168..ca9b3a8b7 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs @@ -76,7 +76,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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); } } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BB.cs b/src/NzbDrone.Core/Indexers/Definitions/BB.cs index 49b730e40..d723b632f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BB.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BB.cs @@ -177,49 +177,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs index 4481c8fe1..574d53a56 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs @@ -178,49 +178,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs index 2f1acc9a3..88e766ae3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs @@ -120,49 +120,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return indexerRequest; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BinSearch.cs b/src/NzbDrone.Core/Indexers/Definitions/BinSearch.cs index 2fe150edc..93bdda440 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BinSearch.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BinSearch.cs @@ -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 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BitHDTV.cs b/src/NzbDrone.Core/Indexers/Definitions/BitHDTV.cs index e3a90251d..1525102d4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BitHDTV.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BitHDTV.cs @@ -129,49 +129,29 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs index c36a90712..73e1154b8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs @@ -34,31 +34,29 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet yield return new IndexerRequest(builder.Build()); } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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); } } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index f0ab21b47..eaf8731d0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -42,12 +42,10 @@ namespace NzbDrone.Core.Indexers.Cardigann public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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 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 GetRequest(Dictionary 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) { diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs index f422fbf16..e0a67978e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs @@ -16,9 +16,8 @@ public class FileListRequestGenerator : IIndexerRequestGenerator public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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 GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters) diff --git a/src/NzbDrone.Core/Indexers/Definitions/FunFile.cs b/src/NzbDrone.Core/Indexers/Definitions/FunFile.cs index 4d7a8bdc7..9bd9e2ed8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FunFile.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FunFile.cs @@ -137,49 +137,29 @@ public class FunFileRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs index b21ae489e..a6b9ef4ec 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs @@ -42,10 +42,8 @@ public class GazelleRequestGenerator : IIndexerRequestGenerator yield return request; } - public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public virtual IEnumerable 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 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 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 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 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 diff --git a/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs b/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs index 4d3224a1a..2090fe6fe 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs @@ -203,49 +203,29 @@ namespace NzbDrone.Core.Indexers.Definitions { } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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() diff --git a/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs b/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs index 5112ee634..a220e1bc5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs @@ -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 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) diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs index b31861381..8072f150b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs @@ -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 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> 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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); } } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDSpace.cs b/src/NzbDrone.Core/Indexers/Definitions/HDSpace.cs index 276ccf033..6e58d0183 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDSpace.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDSpace.cs @@ -178,45 +178,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs index dfb0b71ae..b6347809f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs @@ -166,49 +166,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs index c2169d9cb..f82ac099d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs @@ -25,18 +25,15 @@ namespace NzbDrone.Core.Indexers.Headphones PageSize = 100; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(TvSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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 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); diff --git a/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs index 6ab434c9c..cfadb5c8b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs @@ -212,49 +212,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs index b4ceb0137..ff5d65dd2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs @@ -166,49 +166,29 @@ namespace NzbDrone.Core.Indexers.Definitions _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Libble.cs b/src/NzbDrone.Core/Indexers/Definitions/Libble.cs index e6a806780..b3ac58536 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Libble.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Libble.cs @@ -123,9 +123,8 @@ public class LibbleRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable 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 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } private IEnumerable 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()); diff --git a/src/NzbDrone.Core/Indexers/Definitions/MoreThanTV.cs b/src/NzbDrone.Core/Indexers/Definitions/MoreThanTV.cs index 29f434c3c..2c7cf39de 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/MoreThanTV.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/MoreThanTV.cs @@ -90,28 +90,26 @@ public class MoreThanTVRequestGenerator : IIndexerRequestGenerator }; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) => PerformRequest(searchCriteria); - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) => PerformRequest(searchCriteria); - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) => PerformRequest(searchCriteria); - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) => PerformRequest(searchCriteria); - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) => PerformRequest(searchCriteria); public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - private IndexerPageableRequestChain PerformRequest(SearchCriteriaBase query) + private IEnumerable PerformRequest(SearchCriteriaBase query) { - var chain = new IndexerPageableRequestChain(); - var requests = new List { 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) diff --git a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs index abb3948c6..48c59770b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs @@ -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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests(searchCriteria)); - - return pageableRequests; + return GetPagedRequests(searchCriteria); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests(searchCriteria)); - - return pageableRequests; + return GetPagedRequests(searchCriteria); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs index 2750211b5..850ebdf2a 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs @@ -98,20 +98,18 @@ namespace NzbDrone.Core.Indexers.Definitions yield return new IndexerRequest(builder.Build()); } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRequestGenerator.cs index 297488721..58dc3cfa5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRequestGenerator.cs @@ -26,11 +26,10 @@ namespace NzbDrone.Core.Indexers.Newznab PageSize = 100; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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 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) { diff --git a/src/NzbDrone.Core/Indexers/Definitions/NorBits.cs b/src/NzbDrone.Core/Indexers/Definitions/NorBits.cs index 877f0459c..a438c6345 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/NorBits.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/NorBits.cs @@ -199,49 +199,29 @@ public class NorBitsRequestGenerator : IIndexerRequestGenerator yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/NzbIndex.cs b/src/NzbDrone.Core/Indexers/Definitions/NzbIndex.cs index a9594650e..949e3320b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/NzbIndex.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/NzbIndex.cs @@ -1054,49 +1054,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs index ecb9108f1..08ba51f2d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs @@ -132,9 +132,8 @@ namespace NzbDrone.Core.Indexers.Definitions _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable 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 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); var parameters = new NameValueCollection(); - pageableRequests.Add(GetPagedRequests(searchCriteria, parameters)); - - return pageableRequests; + return GetPagedRequests(searchCriteria, parameters); } private IEnumerable GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters) diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs index 348d69a01..96df03fc8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs @@ -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 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> GetCookies { get; set; } @@ -72,28 +66,24 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetRequest(string.Format("{0}", searchCriteria.SearchTerm))); - - return pageableRequests; + return GetRequest(string.Format("{0}", searchCriteria.SearchTerm)); } } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/PirateTheNet.cs b/src/NzbDrone.Core/Indexers/Definitions/PirateTheNet.cs index a74823d5d..fd3c679ce 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PirateTheNet.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PirateTheNet.cs @@ -135,37 +135,29 @@ public class PirateTheNetRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) diff --git a/src/NzbDrone.Core/Indexers/Definitions/PornoLab.cs b/src/NzbDrone.Core/Indexers/Definitions/PornoLab.cs index cc55ed88d..e07823a61 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PornoLab.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PornoLab.cs @@ -269,49 +269,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs b/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs index 7b0f767f0..367049046 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs @@ -276,49 +276,29 @@ public class PreToMeRequestGenerator : IIndexerRequestGenerator yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs index 31eddb7a9..4557673b9 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs @@ -78,40 +78,29 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg yield return new IndexerRequest(requestBuilder.Build()); } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs index e8fba9c96..f1e66ebd3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs @@ -104,9 +104,8 @@ namespace NzbDrone.Core.Indexers.Definitions _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable 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 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); var parameters = new NameValueCollection(); - pageableRequests.Add(GetPagedRequests(searchCriteria, parameters)); - - return pageableRequests; + return GetPagedRequests(searchCriteria, parameters); } private IEnumerable GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters) diff --git a/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs b/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs index 08b0ba572..fa981266d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs @@ -185,49 +185,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/RuTracker.cs b/src/NzbDrone.Core/Indexers/Definitions/RuTracker.cs index 779e8fec0..7aa8be98b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/RuTracker.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/RuTracker.cs @@ -1506,54 +1506,34 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests(searchCriteria.SanitizedSearchTerm, searchCriteria.Categories); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/SceneHD.cs b/src/NzbDrone.Core/Indexers/Definitions/SceneHD.cs index 4a67b60ad..f747dc761 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SceneHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SceneHD.cs @@ -120,49 +120,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/SceneTime.cs b/src/NzbDrone.Core/Indexers/Definitions/SceneTime.cs index b4eadc877..dfbc978d7 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SceneTime.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SceneTime.cs @@ -141,49 +141,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Shazbat.cs b/src/NzbDrone.Core/Indexers/Definitions/Shazbat.cs index 2748810f7..679deb78e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Shazbat.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Shazbat.cs @@ -124,37 +124,29 @@ public class ShazbatRequestGenerator : IIndexerRequestGenerator _settings = settings; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}")); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}"); } private IEnumerable GetPagedRequests(string term) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Shizaproject.cs b/src/NzbDrone.Core/Indexers/Definitions/Shizaproject.cs index 851c960f5..05f54e480 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Shizaproject.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Shizaproject.cs @@ -129,43 +129,31 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } // Shizaproject doesn't support books, but this function required by interface - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/SpeedApp/SpeedAppBase.cs b/src/NzbDrone.Core/Indexers/Definitions/SpeedApp/SpeedAppBase.cs index 91f4aa0c5..30f56e705 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SpeedApp/SpeedAppBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SpeedApp/SpeedAppBase.cs @@ -140,38 +140,34 @@ namespace NzbDrone.Core.Indexers.Definitions _pageSize = pageSize; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { return GetSearch(searchCriteria, searchCriteria.FullImdbId); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { return GetSearch(searchCriteria); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { return GetSearch(searchCriteria, searchCriteria.FullImdbId, searchCriteria.Season, searchCriteria.Episode); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { return GetSearch(searchCriteria); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { return GetSearch(searchCriteria); } - private IndexerPageableRequestChain GetSearch(SearchCriteriaBase searchCriteria, string imdbId = null, int? season = null, string episode = null) + private IEnumerable 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 GetPagedRequests(string term, int[] categories, int limit, int offset, string imdbId = null, int? season = null, string episode = null) diff --git a/src/NzbDrone.Core/Indexers/Definitions/SpeedCD.cs b/src/NzbDrone.Core/Indexers/Definitions/SpeedCD.cs index 6498af359..bd7b92bb6 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SpeedCD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SpeedCD.cs @@ -225,10 +225,8 @@ public class SpeedCDRequestGenerator : IIndexerRequestGenerator yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs index 4b995c717..03e51310c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs @@ -111,47 +111,33 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MovieSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/TVVault.cs b/src/NzbDrone.Core/Indexers/Definitions/TVVault.cs index c9711c59e..740b10907 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TVVault.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TVVault.cs @@ -160,41 +160,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Toloka.cs b/src/NzbDrone.Core/Indexers/Definitions/Toloka.cs index 4aef0d744..caae946f1 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Toloka.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Toloka.cs @@ -262,28 +262,18 @@ namespace NzbDrone.Core.Indexers.Definitions _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentBytes.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentBytes.cs index 0bdd6265f..b198fb998 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentBytes.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentBytes.cs @@ -183,47 +183,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - return pageableRequests; + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs index 0d48be5fa..bd2ffec36 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs @@ -167,49 +167,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs index f77e97a6d..b3c5505f5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs @@ -14,13 +14,9 @@ namespace NzbDrone.Core.Indexers.TorrentPotato { } - public virtual IndexerPageableRequestChain GetRecentRequests() + public virtual IEnumerable GetRecentRequests() { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests("list", null, null)); - - return pageableRequests; + return GetPagedRequests("list", null, null); } private IEnumerable 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - pageableRequests.Add(GetMovieRequest(searchCriteria)); - return pageableRequests; + return GetMovieRequest(searchCriteria); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentSyndikat.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentSyndikat.cs index e2b899f34..bca024cb3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentSyndikat.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentSyndikat.cs @@ -162,49 +162,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentsCSV.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentsCSV.cs index 9daddda0c..dbb1304aa 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentsCSV.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentsCSV.cs @@ -95,41 +95,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable 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 GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs index 5957534f2..5055c3685 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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 GetRequest(List> searchParameters) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Uniotaku.cs b/src/NzbDrone.Core/Indexers/Definitions/Uniotaku.cs index d2ee6c405..17f5122b5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Uniotaku.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Uniotaku.cs @@ -154,49 +154,29 @@ public class UniotakuRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/XSpeeds.cs b/src/NzbDrone.Core/Indexers/Definitions/XSpeeds.cs index b3e09090f..883119039 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/XSpeeds.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/XSpeeds.cs @@ -173,49 +173,29 @@ public class XSpeedsRequestGenerator : IIndexerRequestGenerator _capabilities = capabilities; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 GetSearchRequests(BasicSearchCriteria searchCriteria) { - var pageableRequests = new IndexerPageableRequestChain(); - - pageableRequests.Add(GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories)); - - return pageableRequests; + return GetPagedRequests($"{searchCriteria.SanitizedSearchTerm}", searchCriteria.Categories); } private IEnumerable GetPagedRequests(string term, int[] categories) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Xthor/XthorRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Xthor/XthorRequestGenerator.cs index ea991d83d..c07fc2888 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Xthor/XthorRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Xthor/XthorRequestGenerator.cs @@ -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 GetSearchRequestsCommon(SearchCriteriaBase searchCriteria, string searchTerm, string tmdbid = null) { - var pageableRequests = new IndexerPageableRequestChain(); var actualPage = 0; + var requests = new List(); + 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm), searchCriteria.TmdbId.ToString()); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm)); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedTvSearchString)); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm)); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { return GetSearchRequestsCommon(searchCriteria, string.Format("{0}", searchCriteria.SanitizedSearchTerm)); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs b/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs index 4e8104116..d076632a2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs @@ -251,49 +251,29 @@ namespace NzbDrone.Core.Indexers.Definitions yield return request; } - public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) + public IEnumerable 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 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 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 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 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> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 29f819c99..6d952cd22 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -233,7 +233,7 @@ namespace NzbDrone.Core.Indexers _indexerStatusService.UpdateCookies(Definition.Id, cookies, expiration); } - protected virtual async Task FetchReleases(Func pageableRequestChainSelector, SearchCriteriaBase searchCriteria, bool isRecent = false) + protected virtual async Task FetchReleases(Func> pageableRequestChainSelector, SearchCriteriaBase searchCriteria, bool isRecent = false) { var releases = new List(); 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(); + 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 page, int pageSize) - { - return pageSize != 0 && page.Count >= pageSize; - } - protected virtual async Task 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) { diff --git a/src/NzbDrone.Core/Indexers/IIndexerRequestGenerator.cs b/src/NzbDrone.Core/Indexers/IIndexerRequestGenerator.cs index 450412aaf..5a7f348a8 100644 --- a/src/NzbDrone.Core/Indexers/IIndexerRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/IIndexerRequestGenerator.cs @@ -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 GetSearchRequests(MovieSearchCriteria searchCriteria); + IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria); + IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria); + IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria); + IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria); Func> GetCookies { get; set; } Action, DateTime?> CookiesUpdater { get; set; } } diff --git a/src/NzbDrone.Core/Indexers/IndexerPageableRequest.cs b/src/NzbDrone.Core/Indexers/IndexerPageableRequest.cs deleted file mode 100644 index dff34143e..000000000 --- a/src/NzbDrone.Core/Indexers/IndexerPageableRequest.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace NzbDrone.Core.Indexers -{ - public class IndexerPageableRequest : IEnumerable - { - private readonly IEnumerable _enumerable; - - public IndexerPageableRequest(IEnumerable enumerable) - { - _enumerable = enumerable; - } - - public IEnumerator GetEnumerator() - { - return _enumerable.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return _enumerable.GetEnumerator(); - } - } -} diff --git a/src/NzbDrone.Core/Indexers/IndexerPageableRequestChain.cs b/src/NzbDrone.Core/Indexers/IndexerPageableRequestChain.cs deleted file mode 100644 index 1671ff1c1..000000000 --- a/src/NzbDrone.Core/Indexers/IndexerPageableRequestChain.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace NzbDrone.Core.Indexers -{ - public class IndexerPageableRequestChain - { - private List> _chains; - - public IndexerPageableRequestChain() - { - _chains = new List>(); - _chains.Add(new List()); - } - - public int Tiers => _chains.Count; - - public IEnumerable GetAllTiers() - { - return _chains.SelectMany(v => v); - } - - public IEnumerable GetTier(int index) - { - return _chains[index]; - } - - public void Add(IEnumerable request) - { - if (request == null) - { - return; - } - - _chains.Last().Add(new IndexerPageableRequest(request)); - } - - public void AddTier(IEnumerable request) - { - AddTier(); - Add(request); - } - - public void AddTier() - { - if (_chains.Last().Count == 0) - { - return; - } - - _chains.Add(new List()); - } - } -} diff --git a/src/NzbDrone.Core/Indexers/RssIndexerRequestGenerator.cs b/src/NzbDrone.Core/Indexers/RssIndexerRequestGenerator.cs index eead09944..0a25e5b44 100644 --- a/src/NzbDrone.Core/Indexers/RssIndexerRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/RssIndexerRequestGenerator.cs @@ -14,38 +14,34 @@ namespace NzbDrone.Core.Indexers _baseUrl = baseUrl; } - public virtual IndexerPageableRequestChain GetRecentRequests() + public virtual IEnumerable 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 GetSearchRequests(MovieSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(MusicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(TvSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(TvSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BookSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } - public IndexerPageableRequestChain GetSearchRequests(BasicSearchCriteria searchCriteria) + public IEnumerable GetSearchRequests(BasicSearchCriteria searchCriteria) { - return new IndexerPageableRequestChain(); + return new List(); } public Func> GetCookies { get; set; }