mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -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
45
NzbDrone.Core/Jobs/RecentBacklogSearchJob.cs
Normal file
45
NzbDrone.Core/Jobs/RecentBacklogSearchJob.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
namespace NzbDrone.Core.Jobs
|
||||
{
|
||||
public class RecentBacklogSearchJob : IJob
|
||||
{
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public RecentBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
_episodeSearchJob = episodeSearchJob;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Recent Backlog Search"; }
|
||||
}
|
||||
|
||||
public int DefaultInterval
|
||||
{
|
||||
get { return 1440; }
|
||||
}
|
||||
|
||||
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||
{
|
||||
//Get episodes that are considered missing and aired in the last 30 days
|
||||
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(true).Where(e => e.AirDate >= DateTime.Today.AddDays(-30));
|
||||
|
||||
Logger.Debug("Processing missing episodes from the last 30 days");
|
||||
//Process the list of remaining episodes, 1 by 1
|
||||
foreach (var episode in missingEpisodes)
|
||||
{
|
||||
_episodeSearchJob.Start(notification, episode.EpisodeId, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue