From c249ad5dbece89d8ef60fa3806de1c703f6de220 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 11 May 2016 19:06:35 +0200 Subject: [PATCH] Using a tiered fallback is safer in case there is another data-loss and ids get reset. --- .../BroadcastheNetRequestGenerator.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetRequestGenerator.cs b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetRequestGenerator.cs index c2898f448..a8f9e2a26 100644 --- a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetRequestGenerator.cs @@ -25,18 +25,18 @@ public virtual IndexerPageableRequestChain GetRecentRequests() { var pageableRequests = new IndexerPageableRequestChain(); - var parameters = new BroadcastheNetTorrentQuery(); - if (LastRecentTorrentID.HasValue) { - parameters.Id = ">=" + (LastRecentTorrentID.Value - 100); + pageableRequests.Add(GetPagedRequests(MaxPages, new BroadcastheNetTorrentQuery() + { + Id = ">=" + (LastRecentTorrentID.Value - 100) + })); } - else + + pageableRequests.AddTier(GetPagedRequests(MaxPages, new BroadcastheNetTorrentQuery() { - parameters.Age = "<=86400"; - } - - pageableRequests.Add(GetPagedRequests(MaxPages, parameters)); + Age = "<=86400" + })); return pageableRequests; } @@ -101,7 +101,7 @@ public virtual IndexerPageableRequestChain GetSearchRequests(SeasonSearchCriteri public virtual IndexerPageableRequestChain GetSearchRequests(DailyEpisodeSearchCriteria searchCriteria) { var pageableRequests = new IndexerPageableRequestChain(); - + var parameters = new BroadcastheNetTorrentQuery(); if (AddSeriesSearchParameters(parameters, searchCriteria)) { @@ -184,7 +184,7 @@ private IEnumerable GetPagedRequests(int maxPages, BroadcastheNe .Call("getTorrents", Settings.ApiKey, parameters, PageSize, 0); builder.SuppressHttpError = true; - for (var page = 0; page < maxPages;page++) + for (var page = 0; page < maxPages; page++) { builder.JsonParameters[3] = page * PageSize;