mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Moved Jobs to their own folder.
This commit is contained in:
parent
cc8c70d7f5
commit
fabc4c84bd
52 changed files with 124 additions and 132 deletions
50
NzbDrone.Core/Jobs/SeriesSearchJob.cs
Normal file
50
NzbDrone.Core/Jobs/SeriesSearchJob.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
namespace NzbDrone.Core.Jobs
|
||||
{
|
||||
public class SeriesSearchJob : IJob
|
||||
{
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private readonly SeasonSearchJob _seasonSearchJob;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public SeriesSearchJob(EpisodeProvider episodeProvider, SeasonSearchJob seasonSearchJob)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
_seasonSearchJob = seasonSearchJob;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Series Search"; }
|
||||
}
|
||||
|
||||
public int DefaultInterval
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||
{
|
||||
if (targetId <= 0)
|
||||
throw new ArgumentOutOfRangeException("targetId");
|
||||
|
||||
Logger.Debug("Getting seasons from database for series: {0}", targetId);
|
||||
var seasons = _episodeProvider.GetSeasons(targetId).Where(s => s > 0);
|
||||
|
||||
foreach (var season in seasons)
|
||||
{
|
||||
//Skip ignored seasons
|
||||
if (_episodeProvider.IsIgnored(targetId, season))
|
||||
continue;
|
||||
|
||||
_seasonSearchJob.Start(notification, targetId, season);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue