1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

New: Allow CheckForFinishedDownloadInterval to be set from the UI (#3233)

* Adding CheckForFinishedDownloadInterval to config service
Changed TaskManager to use a configurable interval for CheckForFinishedDownloadCommand

* Adding new CheckForFinishedDownloadInterval to UI

Fixes #840
This commit is contained in:
Steven Crouchman 2019-05-02 11:51:21 +01:00 committed by Leonardo Galli
parent 9985554dcb
commit f411903e90
5 changed files with 33 additions and 3 deletions

View File

@ -1,4 +1,4 @@
using NzbDrone.Api.REST;
using NzbDrone.Api.REST;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Api.Config
@ -11,6 +11,7 @@ public class DownloadClientConfigResource : RestResource
public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public int CheckForFinishedDownloadInterval { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool RemoveFailedDownloads { get; set; }
@ -28,6 +29,7 @@ public static DownloadClientConfigResource ToResource(IConfigService model)
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed,
RemoveFailedDownloads = model.RemoveFailedDownloads

View File

@ -273,6 +273,13 @@ public int DownloadedMoviesScanInterval
set { SetValue("DownloadedMoviesScanInterval", value); }
}
public int CheckForFinishedDownloadInterval
{
get { return GetValueInt("CheckForFinishedDownloadInterval", 1); }
set { SetValue("CheckForFinishedDownloadInterval", value); }
}
public int DownloadClientHistoryLimit
{
get { return GetValueInt("DownloadClientHistoryLimit", 30); }

View File

@ -16,6 +16,7 @@ public interface IConfigService
string DownloadClientWorkingFolders { get; set; }
int DownloadedMoviesScanInterval { get; set; }
int DownloadClientHistoryLimit { get; set; }
int CheckForFinishedDownloadInterval { get; set; }
//Completed/Failed Download Handling (Download client)
bool EnableCompletedDownloadHandling { get; set; }

View File

@ -71,7 +71,6 @@ public void Handle(ApplicationStartedEvent message)
var defaultTasks = new[]
{
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFinishedDownloadCommand).FullName},
new ScheduledTask{ Interval = 1*60, TypeName = typeof(PreDBSyncCommand).FullName},
new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).FullName},
new ScheduledTask{ Interval = updateInterval, TypeName = typeof(ApplicationUpdateCommand).FullName},
@ -98,6 +97,12 @@ public void Handle(ApplicationStartedEvent message)
Interval = _configService.DownloadedMoviesScanInterval,
TypeName = typeof(DownloadedMoviesScanCommand).FullName
},
new ScheduledTask
{
Interval = Math.Max(_configService.CheckForFinishedDownloadInterval, 1),
TypeName = typeof(CheckForFinishedDownloadCommand).FullName
},
};
var currentTasks = _scheduledTaskRepository.All().ToList();
@ -184,7 +189,10 @@ public void HandleAsync(ConfigSavedEvent message)
var netImport = _scheduledTaskRepository.GetDefinition(typeof(NetImportSyncCommand));
netImport.Interval = _configService.NetImportSyncInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedMovies, netImport });
var checkForFinishedDownloads = _scheduledTaskRepository.GetDefinition(typeof(CheckForFinishedDownloadCommand));
checkForFinishedDownloads.Interval = _configService.CheckForFinishedDownloadInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedMovies, netImport, checkForFinishedDownloads });
}
}
}

View File

@ -43,6 +43,18 @@
</div>
</div>
</div>
<div class="form-group advanced-settings">
<label class="col-sm-3 control-label">Check For Finished Downloads Interval</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-radarr-form-info" title="Interval in minutes to query the download clients for finished downloads"/>
</div>
<div class="col-sm-2 col-sm-pull-1">
<input type="number" name="checkForFinishedDownloadInterval" class="form-control" />
</div>
</div>
</div>
</fieldset>