diff --git a/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs b/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs index f3fa14e8b..c6525577c 100644 --- a/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs +++ b/src/NzbDrone.Api/Config/DownloadClientConfigResource.cs @@ -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; } diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index 465b422b6..9626b969b 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -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); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index 6540ebf45..9a513e75a 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -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; } diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index c9c29d904..65cc35f80 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -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 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{ rss, downloadedEpisodes }); } } } diff --git a/src/UI/Settings/DownloadClient/Options/DownloadClientOptionsViewTemplate.html b/src/UI/Settings/DownloadClient/Options/DownloadClientOptionsViewTemplate.html index 888161027..b6824fb6b 100644 --- a/src/UI/Settings/DownloadClient/Options/DownloadClientOptionsViewTemplate.html +++ b/src/UI/Settings/DownloadClient/Options/DownloadClientOptionsViewTemplate.html @@ -11,4 +11,16 @@ + +
+ + +
+ + + + + +
+
\ No newline at end of file