mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-22 22:14:44 -04:00
37959fd753
New: Series/Season search will not grab unmonitored episodes Fixed: Missing episode search won't grab missing unmonitored episodes by mistake
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using System.Linq;
|
|
using NLog;
|
|
using NzbDrone.Common.Instrumentation.Extensions;
|
|
using NzbDrone.Core.Download;
|
|
using NzbDrone.Core.Messaging.Commands;
|
|
using NzbDrone.Core.Tv;
|
|
|
|
namespace NzbDrone.Core.IndexerSearch
|
|
{
|
|
public class SeriesSearchService : IExecute<SeriesSearchCommand>
|
|
{
|
|
private readonly ISeriesService _seriesService;
|
|
private readonly ISearchForNzb _nzbSearchService;
|
|
private readonly IProcessDownloadDecisions _processDownloadDecisions;
|
|
private readonly Logger _logger;
|
|
|
|
public SeriesSearchService(ISeriesService seriesService,
|
|
ISearchForNzb nzbSearchService,
|
|
IProcessDownloadDecisions processDownloadDecisions,
|
|
Logger logger)
|
|
{
|
|
_seriesService = seriesService;
|
|
_nzbSearchService = nzbSearchService;
|
|
_processDownloadDecisions = processDownloadDecisions;
|
|
_logger = logger;
|
|
}
|
|
|
|
public void Execute(SeriesSearchCommand message)
|
|
{
|
|
var series = _seriesService.GetSeries(message.SeriesId);
|
|
|
|
var downloadedCount = 0;
|
|
|
|
foreach (var season in series.Seasons.OrderBy(s => s.SeasonNumber))
|
|
{
|
|
if (!season.Monitored)
|
|
{
|
|
_logger.Debug("Season {0} of {1} is not monitored, skipping search", season.SeasonNumber, series.Title);
|
|
continue;
|
|
}
|
|
|
|
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber);
|
|
downloadedCount += _processDownloadDecisions.ProcessDecisions(decisions).Grabbed.Count;
|
|
}
|
|
|
|
_logger.ProgressInfo("Series search completed. {0} reports downloaded.", downloadedCount);
|
|
}
|
|
}
|
|
}
|