mirror of https://github.com/Radarr/Radarr
Past Week Backlog Search job added
New: Manually search for all missing episodes form the last 7 days (from Missing page)
This commit is contained in:
parent
92bd547315
commit
8a7d474b74
|
@ -0,0 +1,58 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
using NzbDrone.Core.Model.Notification;
|
||||||
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using NzbDrone.Core.Repository;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Jobs
|
||||||
|
{
|
||||||
|
public class PastWeekBacklogSearchJob : IJob
|
||||||
|
{
|
||||||
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
public PastWeekBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||||
|
ConfigProvider configProvider)
|
||||||
|
{
|
||||||
|
_episodeProvider = episodeProvider;
|
||||||
|
_episodeSearchJob = episodeSearchJob;
|
||||||
|
_configProvider = configProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "Past Week Backlog Search"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeSpan DefaultInterval
|
||||||
|
{
|
||||||
|
get { return TimeSpan.FromTicks(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||||
|
{
|
||||||
|
var missingEpisodes = GetMissingForEnabledSeries();
|
||||||
|
|
||||||
|
Logger.Debug("Processing missing episodes from the past week, count: {0}", missingEpisodes.Count);
|
||||||
|
foreach (var episode in missingEpisodes)
|
||||||
|
{
|
||||||
|
_episodeSearchJob.Start(notification, episode.EpisodeId, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Episode> GetMissingForEnabledSeries()
|
||||||
|
{
|
||||||
|
return _episodeProvider.EpisodesWithoutFiles(true).Where(e =>
|
||||||
|
e.AirDate >= DateTime.Today.AddDays(-7) &&
|
||||||
|
e.Series.Monitored
|
||||||
|
).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -248,6 +248,7 @@
|
||||||
<Compile Include="Helpers\SortHelper.cs" />
|
<Compile Include="Helpers\SortHelper.cs" />
|
||||||
<Compile Include="Helpers\SabnzbdPriorityTypeConverter.cs" />
|
<Compile Include="Helpers\SabnzbdPriorityTypeConverter.cs" />
|
||||||
<Compile Include="Jobs\CheckpointJob.cs" />
|
<Compile Include="Jobs\CheckpointJob.cs" />
|
||||||
|
<Compile Include="Jobs\PastWeekBacklogSearchJob.cs" />
|
||||||
<Compile Include="Jobs\SearchHistoryCleanupJob.cs" />
|
<Compile Include="Jobs\SearchHistoryCleanupJob.cs" />
|
||||||
<Compile Include="Model\DownloadClientType.cs" />
|
<Compile Include="Model\DownloadClientType.cs" />
|
||||||
<Compile Include="Instrumentation\LogDbContext.cs" />
|
<Compile Include="Instrumentation\LogDbContext.cs" />
|
||||||
|
|
|
@ -52,6 +52,12 @@ namespace NzbDrone.Web.Controllers
|
||||||
return JsonNotificationResult.Queued("Recent backlog search");
|
return JsonNotificationResult.Queued("Recent backlog search");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonResult PastWeekBacklogSearch()
|
||||||
|
{
|
||||||
|
_jobProvider.QueueJob(typeof(PastWeekBacklogSearchJob));
|
||||||
|
return JsonNotificationResult.Queued("Past Week backlog search");
|
||||||
|
}
|
||||||
|
|
||||||
public JsonResult ForceRefresh(int seriesId)
|
public JsonResult ForceRefresh(int seriesId)
|
||||||
{
|
{
|
||||||
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
|
_jobProvider.QueueJob(typeof(UpdateInfoJob), seriesId);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null, null, new { Title = "Check for newly released downloads" })</li>
|
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null, null, new { Title = "Check for newly released downloads" })</li>
|
||||||
<li>@Ajax.ActionLink("Start Backlog Search", "BacklogSearch", "Command",null, null, new { title = "Search and download all missing episodes"})</li>
|
<li>@Ajax.ActionLink("Start Backlog Search", "BacklogSearch", "Command",null, null, new { title = "Search and download all missing episodes"})</li>
|
||||||
<li>@Ajax.ActionLink("Start Recent Backlog Search", "RecentBacklogSearch", "Command", null, null, new { title = "Search and download missing episodes that aired in the last 30 days" })</li>
|
<li>@Ajax.ActionLink("Start Recent Backlog Search", "RecentBacklogSearch", "Command", null, null, new { title = "Search and download missing episodes that aired in the last 30 days" })</li>
|
||||||
|
<li>@Ajax.ActionLink("Force Past Week Backlog Search", "PastWeekBacklogSearch", "Command", null, null, new { title = "Search and download missing episodes that aired in the last 7 days (Ignores backlog search settings)" })</li>
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue