mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Series search added
This commit is contained in:
parent
125f3d87a4
commit
d19e33f0a8
7 changed files with 83 additions and 9 deletions
37
NzbDrone.Core/IndexerSearch/SeriesSearchService.cs
Normal file
37
NzbDrone.Core/IndexerSearch/SeriesSearchService.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System.Linq;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.IndexerSearch
|
||||
{
|
||||
public class SeriesSearchService : IExecute<SeriesSearchCommand>
|
||||
{
|
||||
private readonly ISeasonService _seasonService;
|
||||
private readonly ISearchForNzb _nzbSearchService;
|
||||
private readonly IDownloadApprovedReports _downloadApprovedReports;
|
||||
|
||||
public SeriesSearchService(ISeasonService seasonService,
|
||||
ISearchForNzb nzbSearchService,
|
||||
IDownloadApprovedReports downloadApprovedReports)
|
||||
{
|
||||
_seasonService = seasonService;
|
||||
_nzbSearchService = nzbSearchService;
|
||||
_downloadApprovedReports = downloadApprovedReports;
|
||||
}
|
||||
|
||||
public void Execute(SeriesSearchCommand message)
|
||||
{
|
||||
var seasons = _seasonService.GetSeasonsBySeries(message.SeriesId)
|
||||
.Where(s => s.SeasonNumber > 0)
|
||||
.OrderBy(s => s.SeasonNumber)
|
||||
.ToList();
|
||||
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
var decisions = _nzbSearchService.SeasonSearch(message.SeriesId, season.SeasonNumber);
|
||||
_downloadApprovedReports.DownloadApproved(decisions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue