mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
moved jobs around again ;)
This commit is contained in:
parent
50674d388c
commit
568d4b8eeb
29 changed files with 70 additions and 121 deletions
50
NzbDrone.Core/Jobs/Implementations/SeriesSearchJob.cs
Normal file
50
NzbDrone.Core/Jobs/Implementations/SeriesSearchJob.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Jobs.Implementations
|
||||
{
|
||||
public class SeriesSearchJob : IJob
|
||||
{
|
||||
private readonly SeasonSearchJob _seasonSearchJob;
|
||||
private readonly ISeasonRepository _seasonRepository;
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public SeriesSearchJob(SeasonSearchJob seasonSearchJob, ISeasonRepository seasonRepository)
|
||||
{
|
||||
_seasonSearchJob = seasonSearchJob;
|
||||
_seasonRepository = seasonRepository;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Series Search"; }
|
||||
}
|
||||
|
||||
public TimeSpan DefaultInterval
|
||||
{
|
||||
get { return TimeSpan.FromTicks(0); }
|
||||
}
|
||||
|
||||
public void Start(ProgressNotification notification, dynamic options)
|
||||
{
|
||||
if (options == null || options.SeriesId <= 0)
|
||||
throw new ArgumentException("options.SeriesId");
|
||||
|
||||
logger.Debug("Getting seasons from database for series: {0}", options.SeriesId);
|
||||
IList<int> seasons = _seasonRepository.GetSeasonNumbers((int)options.SeriesId);
|
||||
|
||||
foreach (var season in seasons.Where(s => s > 0))
|
||||
{
|
||||
if (!_seasonRepository.IsIgnored((int)options.SeriesId, season))
|
||||
{
|
||||
_seasonSearchJob.Start(notification, new { SeriesId = options.SeriesId, SeasonNumber = season });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue