New: Set scanning interval for Drone Factory

pull/65/head
Mark McDowall 11 years ago
parent 0914441de7
commit c2ab59f5c5

@ -7,6 +7,7 @@ namespace NzbDrone.Api.Config
{
public String DownloadedEpisodesFolder { get; set; }
public String DownloadClientWorkingFolders { get; set; }
public Int32 DownloadedEpisodesScanInterval { get; set; }
public Boolean AutoRedownloadFailed { get; set; }
public Boolean RemoveFailedDownloads { get; set; }

@ -157,6 +157,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadClientWorkingFolders", value); }
}
public Int32 DownloadedEpisodesScanInterval
{
get { return GetValueInt("DownloadedEpisodesScanInterval", 1); }
set { SetValue("DownloadedEpisodesScanInterval", value); }
}
public Boolean SetPermissionsLinux
{
get { return GetValueBoolean("SetPermissionsLinux", false); }

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Configuration
//Download Client
String DownloadedEpisodesFolder { get; set; }
String DownloadClientWorkingFolders { get; set; }
Int32 DownloadedEpisodesScanInterval { get; set; }
//Failed Download Handling (Download client)
Boolean AutoRedownloadFailed { get; set; }

@ -5,7 +5,6 @@ using NLog;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.DataAugmentation.Xem;
using NzbDrone.Core.Download;
using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.Housekeeping;
@ -40,14 +39,15 @@ namespace NzbDrone.Core.Jobs
public IList<ScheduledTask> GetPending()
{
return _scheduledTaskRepository.All().Where(c => c.LastExecution.AddMinutes(c.Interval) < DateTime.UtcNow).ToList();
return _scheduledTaskRepository.All()
.Where(c => c.Interval > 0 && c.LastExecution.AddMinutes(c.Interval) < DateTime.UtcNow)
.ToList();
}
public void Handle(ApplicationStartedEvent message)
{
var defaultTasks = new[]
{
new ScheduledTask{ Interval = _configService.RssSyncInterval, TypeName = typeof(RssSyncCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(DownloadedEpisodesScanCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(TrackedCommandCleanupCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFailedDownloadCommand).FullName},
@ -57,6 +57,18 @@ namespace NzbDrone.Core.Jobs
new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshSeriesCommand).FullName},
new ScheduledTask{ Interval = 24*60, TypeName = typeof(HousekeepingCommand).FullName},
new ScheduledTask
{
Interval = _configService.RssSyncInterval,
TypeName = typeof(RssSyncCommand).FullName
},
new ScheduledTask
{
Interval = _configService.DownloadedEpisodesScanInterval,
TypeName = typeof(DownloadedEpisodesScanCommand).FullName
},
};
var currentTasks = _scheduledTaskRepository.All().ToList();
@ -102,7 +114,11 @@ namespace NzbDrone.Core.Jobs
{
var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand));
rss.Interval = _configService.RssSyncInterval;
_scheduledTaskRepository.Update(rss);
var downloadedEpisodes = _scheduledTaskRepository.GetDefinition(typeof(DownloadedEpisodesScanCommand));
downloadedEpisodes.Interval = _configService.DownloadedEpisodesScanInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask>{ rss, downloadedEpisodes });
}
}
}

@ -11,4 +11,16 @@
</span>
</div>
</div>
<div class="control-group advanced-setting">
<label class="control-label">Drone Factory Internal</label>
<div class="controls">
<input type="number" name="downloadedEpisodesScanInterval"/>
<span class="help-inline">
<i class="icon-nd-form-info" title="Interval in minutes to scan the Drone Factory. Set to zero to disable."/>
<i class="icon-nd-form-warning" title="Setting a high interval or disabling scanning will prevent episodes from being imported."></i>
</span>
</div>
</div>
</fieldset>
Loading…
Cancel
Save