|
|
|
@ -9,17 +9,17 @@ namespace NzbDrone.Core.IndexerSearch
|
|
|
|
|
{
|
|
|
|
|
public class SeriesSearchService : IExecute<SeriesSearchCommand>
|
|
|
|
|
{
|
|
|
|
|
private readonly ISeasonService _seasonService;
|
|
|
|
|
private readonly ISeriesService _seriesService;
|
|
|
|
|
private readonly ISearchForNzb _nzbSearchService;
|
|
|
|
|
private readonly IDownloadApprovedReports _downloadApprovedReports;
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
public SeriesSearchService(ISeasonService seasonService,
|
|
|
|
|
public SeriesSearchService(ISeriesService seriesService,
|
|
|
|
|
ISearchForNzb nzbSearchService,
|
|
|
|
|
IDownloadApprovedReports downloadApprovedReports,
|
|
|
|
|
Logger logger)
|
|
|
|
|
{
|
|
|
|
|
_seasonService = seasonService;
|
|
|
|
|
_seriesService = seriesService;
|
|
|
|
|
_nzbSearchService = nzbSearchService;
|
|
|
|
|
_downloadApprovedReports = downloadApprovedReports;
|
|
|
|
|
_logger = logger;
|
|
|
|
@ -27,14 +27,11 @@ namespace NzbDrone.Core.IndexerSearch
|
|
|
|
|
|
|
|
|
|
public void Execute(SeriesSearchCommand message)
|
|
|
|
|
{
|
|
|
|
|
var seasons = _seasonService.GetSeasonsBySeries(message.SeriesId)
|
|
|
|
|
.Where(s => s.SeasonNumber > 0)
|
|
|
|
|
.OrderBy(s => s.SeasonNumber)
|
|
|
|
|
.ToList();
|
|
|
|
|
var series = _seriesService.GetSeries(message.SeriesId);
|
|
|
|
|
|
|
|
|
|
var downloadedCount = 0;
|
|
|
|
|
|
|
|
|
|
foreach (var season in seasons)
|
|
|
|
|
foreach (var season in series.Seasons)
|
|
|
|
|
{
|
|
|
|
|
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber);
|
|
|
|
|
downloadedCount += _downloadApprovedReports.DownloadApproved(decisions).Count;
|
|
|
|
|