mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
New: Set scanning interval for Drone Factory
This commit is contained in:
parent
0914441de7
commit
c2ab59f5c5
@ -7,6 +7,7 @@ public class DownloadClientConfigResource : RestResource
|
||||
{
|
||||
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 @@ public String DownloadClientWorkingFolders
|
||||
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 @@ public interface IConfigService
|
||||
//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 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 @@ public TaskManager(IScheduledTaskRepository scheduledTaskRepository, IConfigServ
|
||||
|
||||
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 @@ public void Handle(ApplicationStartedEvent message)
|
||||
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 @@ public void HandleAsync(ConfigSavedEvent message)
|
||||
{
|
||||
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…
Reference in New Issue
Block a user