mirror of https://github.com/Radarr/Radarr
Backlog searching will be disabled by default. Option is available in Settings/Misc
This commit is contained in:
parent
3e9593ba3b
commit
11b6720cd1
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
|
@ -12,15 +13,17 @@ namespace NzbDrone.Core.Jobs
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
private readonly SeasonSearchJob _seasonSearchJob;
|
private readonly SeasonSearchJob _seasonSearchJob;
|
||||||
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||||
SeasonSearchJob seasonSearchJob)
|
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
|
||||||
{
|
{
|
||||||
_episodeProvider = episodeProvider;
|
_episodeProvider = episodeProvider;
|
||||||
_episodeSearchJob = episodeSearchJob;
|
_episodeSearchJob = episodeSearchJob;
|
||||||
_seasonSearchJob = seasonSearchJob;
|
_seasonSearchJob = seasonSearchJob;
|
||||||
|
_configProvider = configProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -35,6 +38,12 @@ namespace NzbDrone.Core.Jobs
|
||||||
|
|
||||||
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||||
{
|
{
|
||||||
|
if (!_configProvider.EnableBacklogSearching)
|
||||||
|
{
|
||||||
|
Logger.Trace("Backlog searching is not enabled, aborting job.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(true)
|
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(true)
|
||||||
.GroupBy(e => new { e.SeriesId, e.SeasonNumber });
|
.GroupBy(e => new { e.SeriesId, e.SeasonNumber });
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
|
@ -10,13 +11,16 @@ namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
private readonly EpisodeProvider _episodeProvider;
|
private readonly EpisodeProvider _episodeProvider;
|
||||||
private readonly EpisodeSearchJob _episodeSearchJob;
|
private readonly EpisodeSearchJob _episodeSearchJob;
|
||||||
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public RecentBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob)
|
public RecentBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||||
|
ConfigProvider configProvider)
|
||||||
{
|
{
|
||||||
_episodeProvider = episodeProvider;
|
_episodeProvider = episodeProvider;
|
||||||
_episodeSearchJob = episodeSearchJob;
|
_episodeSearchJob = episodeSearchJob;
|
||||||
|
_configProvider = configProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
|
@ -31,6 +35,12 @@ namespace NzbDrone.Core.Jobs
|
||||||
|
|
||||||
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||||
{
|
{
|
||||||
|
if (!_configProvider.EnableBacklogSearching)
|
||||||
|
{
|
||||||
|
Logger.Trace("Backlog searching is not enabled, aborting job.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Get episodes that are considered missing and aired in the last 30 days
|
//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));
|
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(true).Where(e => e.AirDate >= DateTime.Today.AddDays(-30));
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,12 @@ namespace NzbDrone.Core.Providers.Core
|
||||||
set { SetValue("ProwlPriority", value); }
|
set { SetValue("ProwlPriority", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool EnableBacklogSearching
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("EnableBacklogSearching"); }
|
||||||
|
set { SetValue("EnableBacklogSearching", value); }
|
||||||
|
}
|
||||||
|
|
||||||
private string GetValue(string key)
|
private string GetValue(string key)
|
||||||
{
|
{
|
||||||
return GetValue(key, String.Empty);
|
return GetValue(key, String.Empty);
|
||||||
|
|
|
@ -221,6 +221,14 @@ namespace NzbDrone.Web.Controllers
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult Misc()
|
||||||
|
{
|
||||||
|
var model = new MiscSettingsModel();
|
||||||
|
model.EnableBacklogSearching = _configProvider.EnableBacklogSearching;
|
||||||
|
|
||||||
|
return View(model);
|
||||||
|
}
|
||||||
|
|
||||||
public PartialViewResult AddProfile()
|
public PartialViewResult AddProfile()
|
||||||
{
|
{
|
||||||
var qualityProfile = new QualityProfile
|
var qualityProfile = new QualityProfile
|
||||||
|
@ -582,6 +590,19 @@ namespace NzbDrone.Web.Controllers
|
||||||
return GetInvalidModelResult();
|
return GetInvalidModelResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public JsonResult SaveMisc(MiscSettingsModel data)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
_configProvider.EnableBacklogSearching = data.EnableBacklogSearching;
|
||||||
|
|
||||||
|
return GetSuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetInvalidModelResult();
|
||||||
|
}
|
||||||
|
|
||||||
private JsonResult GetSuccessResult()
|
private JsonResult GetSuccessResult()
|
||||||
{
|
{
|
||||||
return Json(new NotificationResult() { Title = "Settings Saved" });
|
return Json(new NotificationResult() { Title = "Settings Saved" });
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using NzbDrone.Core.Model;
|
||||||
|
|
||||||
|
namespace NzbDrone.Web.Models
|
||||||
|
{
|
||||||
|
public class MiscSettingsModel
|
||||||
|
{
|
||||||
|
[DisplayName("Enable Backlog Searching")]
|
||||||
|
[Description("Should NzbDrone try tp download missing episodes automatically?")]
|
||||||
|
public bool EnableBacklogSearching { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -226,6 +226,7 @@
|
||||||
<Compile Include="Helpers\DescriptionExtension.cs" />
|
<Compile Include="Helpers\DescriptionExtension.cs" />
|
||||||
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
|
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
|
||||||
<Compile Include="Helpers\IsCurrentActionHelper.cs" />
|
<Compile Include="Helpers\IsCurrentActionHelper.cs" />
|
||||||
|
<Compile Include="Models\MiscSettingsModel.cs" />
|
||||||
<Compile Include="Models\QualityProfileModel.cs" />
|
<Compile Include="Models\QualityProfileModel.cs" />
|
||||||
<Compile Include="Models\FooterModel.cs" />
|
<Compile Include="Models\FooterModel.cs" />
|
||||||
<Compile Include="Models\ExistingSeriesModel.cs" />
|
<Compile Include="Models\ExistingSeriesModel.cs" />
|
||||||
|
@ -525,6 +526,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Shared\_ReferenceLayout.cshtml" />
|
<Content Include="Views\Shared\_ReferenceLayout.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Views\Settings\Misc.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<li>@Html.ActionLink("SABnzbd", "Sabnzbd", "Settings")</li>
|
<li>@Html.ActionLink("SABnzbd", "Sabnzbd", "Settings")</li>
|
||||||
<li>@Html.ActionLink("Notifications", "Notifications", "Settings")</li>
|
<li>@Html.ActionLink("Notifications", "Notifications", "Settings")</li>
|
||||||
<li>@Html.ActionLink("System", "System", "Settings")</li>
|
<li>@Html.ActionLink("System", "System", "Settings")</li>
|
||||||
|
<li>@Html.ActionLink("Misc", "Misc", "Settings")</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
@using NzbDrone.Web.Helpers
|
||||||
|
@model NzbDrone.Web.Models.MiscSettingsModel
|
||||||
|
@{ Layout = "~/Views/Shared/_ReferenceLayout.cshtml"; }
|
||||||
|
|
||||||
|
@section HeaderContent{
|
||||||
|
@Html.IncludeCss("Settings.css")
|
||||||
|
}
|
||||||
|
<div id="stylized">
|
||||||
|
@using (Html.BeginForm("SaveMisc", "Settings", FormMethod.Post, new { id = "MiscForm", name = "MiscForm", @class = "settingsForm" }))
|
||||||
|
{
|
||||||
|
<label class="labelClass">@Html.LabelFor(m => m.EnableBacklogSearching)
|
||||||
|
<span class="small">@Html.DescriptionFor(m => m.EnableBacklogSearching)</span>
|
||||||
|
</label>
|
||||||
|
@Html.CheckBoxFor(m => m.EnableBacklogSearching, new { @class = "inputClass checkClass" })
|
||||||
|
|
||||||
|
<div style="overflow: hidden; height: 50px;"></div>
|
||||||
|
|
||||||
|
<button type="submit" class="save_button" disabled="disabled">
|
||||||
|
Save</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
@section Scripts{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue