From 1e2ba691ed7a3c814e40da35bdb6df4851adf020 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Tue, 5 May 2015 17:42:41 +0200 Subject: [PATCH] Don't run DownloadCompletedEvent if DownloadItem not Completed. --- src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs | 2 +- src/NzbDrone.Core/Download/DownloadClientBase.cs | 2 +- src/NzbDrone.Core/Download/DownloadEventHub.cs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index 1730de4b3..83313b7ba 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget queueItem.Category = item.Category; queueItem.DownloadClient = Definition.Name; - if (globalStatus.DownloadPaused || remainingSize == pausedSize) + if (globalStatus.DownloadPaused || remainingSize == pausedSize && remainingSize != 0) { queueItem.Status = DownloadItemStatus.Paused; queueItem.RemainingSize = remainingSize; diff --git a/src/NzbDrone.Core/Download/DownloadClientBase.cs b/src/NzbDrone.Core/Download/DownloadClientBase.cs index 5ef4ec582..f1ca8a6b4 100644 --- a/src/NzbDrone.Core/Download/DownloadClientBase.cs +++ b/src/NzbDrone.Core/Download/DownloadClientBase.cs @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Download return; } - if (item.OutputPath == null) + if (item.OutputPath.IsEmpty) { _logger.Trace("[{0}] Doesn't have an outputPath, skipping delete data.", item.Title); return; diff --git a/src/NzbDrone.Core/Download/DownloadEventHub.cs b/src/NzbDrone.Core/Download/DownloadEventHub.cs index e10311324..e534aa7c2 100644 --- a/src/NzbDrone.Core/Download/DownloadEventHub.cs +++ b/src/NzbDrone.Core/Download/DownloadEventHub.cs @@ -35,7 +35,10 @@ namespace NzbDrone.Core.Download public void Handle(DownloadCompletedEvent message) { - if (message.TrackedDownload.DownloadItem.Removed || message.TrackedDownload.DownloadItem.IsReadOnly || !_configService.RemoveCompletedDownloads) + if (!_configService.RemoveCompletedDownloads || + message.TrackedDownload.DownloadItem.Removed || + message.TrackedDownload.DownloadItem.IsReadOnly || + message.TrackedDownload.DownloadItem.Status == DownloadItemStatus.Downloading) { return; }