1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

Interactive Season Search

New: Interactive Season Search
Fixed: BTN will no longer include season packs for individual episode searches
This commit is contained in:
Mark McDowall 2018-08-31 19:04:23 -07:00 committed by Taloth Saldono
parent 36b9c51163
commit 3b042707f5
2 changed files with 24 additions and 15 deletions

View File

@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
@ -55,19 +55,6 @@ public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearch
pageableRequests.Add(GetPagedRequests(MaxPages, parameters)); pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
} }
if (searchCriteria.UserInvokedSearch)
{
foreach (var seasonNumber in searchCriteria.Episodes.Select(v => v.SeasonNumber).Distinct())
{
parameters = parameters.Clone();
parameters.Category = "Season";
parameters.Name = string.Format("Season {0}%", seasonNumber);
pageableRequests.Add(GetPagedRequests(MaxPages, parameters));
}
}
} }
return pageableRequests; return pageableRequests;

View File

@ -84,6 +84,11 @@ private List<ReleaseResource> GetReleases()
return GetEpisodeReleases(Request.Query.episodeId); return GetEpisodeReleases(Request.Query.episodeId);
} }
if (Request.Query.seriesId.HasValue && Request.Query.seasonNumber.HasValue)
{
return GetSeasonReleases(Request.Query.seriesId, Request.Query.seasonNumber);
}
return GetRss(); return GetRss();
} }
@ -98,7 +103,24 @@ private List<ReleaseResource> GetEpisodeReleases(int episodeId)
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.ErrorException("Episode search failed: " + ex.Message, ex); _logger.Error(ex, "Episode search failed: " + ex.Message);
}
return new List<ReleaseResource>();
}
private List<ReleaseResource> GetSeasonReleases(int seriesId, int seasonNumber)
{
try
{
var decisions = _nzbSearchService.SeasonSearch(seriesId, seasonNumber, false, true, true);
var prioritizedDecisions = _prioritizeDownloadDecision.PrioritizeDecisions(decisions);
return MapDecisions(prioritizedDecisions);
}
catch (Exception ex)
{
_logger.Error(ex, "Season search failed: " + ex.Message);
} }
return new List<ReleaseResource>(); return new List<ReleaseResource>();