1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Hide completed downloads when CDH is disabled

New: Only show completed downloads in queue when Completed Download Handling is enabled
This commit is contained in:
Mark McDowall 2015-09-03 18:38:10 -07:00
parent 19f09fdb86
commit a2f62a5dcd

View File

@ -58,15 +58,17 @@ private void Refresh()
{
var downloadClients = _downloadClientProvider.GetDownloadClients();
var trackedDownload = new List<TrackedDownload>();
var trackedDownloads = new List<TrackedDownload>();
foreach (var downloadClient in downloadClients)
{
var clientTrackedDownloads = ProcessClientDownloads(downloadClient);
trackedDownload.AddRange(clientTrackedDownloads.Where(c => c.State == TrackedDownloadStage.Downloading));
// Only track completed downloads if
trackedDownloads.AddRange(clientTrackedDownloads.Where(DownloadIsTrackable));
}
_eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(trackedDownload));
_eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(trackedDownloads));
}
finally
{
@ -139,6 +141,23 @@ private List<TrackedDownload> ProcessClientItems(IDownloadClient downloadClient,
return trackedDownloads;
}
private bool DownloadIsTrackable(TrackedDownload trackedDownload)
{
// If the download has already been imported or failed don't track it
if (trackedDownload.State != TrackedDownloadStage.Downloading)
{
return false;
}
// If CDH is disabled and the download status is complete don't track it
if (!_configService.EnableCompletedDownloadHandling && trackedDownload.DownloadItem.Status == DownloadItemStatus.Completed)
{
return false;
}
return true;
}
public void Execute(CheckForFinishedDownloadCommand message)
{
Refresh();