@ -1,5 +1,7 @@
using System.Collections.Generic ;
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Linq ;
using NLog ;
using NzbDrone.Core.Configuration ;
using NzbDrone.Core.Configuration ;
using NzbDrone.Core.Download.TrackedDownloads ;
using NzbDrone.Core.Download.TrackedDownloads ;
using NzbDrone.Core.Messaging.Commands ;
using NzbDrone.Core.Messaging.Commands ;
@ -14,18 +16,21 @@ namespace NzbDrone.Core.Download
private readonly IFailedDownloadService _failedDownloadService ;
private readonly IFailedDownloadService _failedDownloadService ;
private readonly ITrackedDownloadService _trackedDownloadService ;
private readonly ITrackedDownloadService _trackedDownloadService ;
private readonly IEventAggregator _eventAggregator ;
private readonly IEventAggregator _eventAggregator ;
private readonly ILogger _logger ;
public DownloadProcessingService ( IConfigService configService ,
public DownloadProcessingService ( IConfigService configService ,
ICompletedDownloadService completedDownloadService ,
ICompletedDownloadService completedDownloadService ,
IFailedDownloadService failedDownloadService ,
IFailedDownloadService failedDownloadService ,
ITrackedDownloadService trackedDownloadService ,
ITrackedDownloadService trackedDownloadService ,
IEventAggregator eventAggregator )
IEventAggregator eventAggregator ,
ILogger logger )
{
{
_configService = configService ;
_configService = configService ;
_completedDownloadService = completedDownloadService ;
_completedDownloadService = completedDownloadService ;
_failedDownloadService = failedDownloadService ;
_failedDownloadService = failedDownloadService ;
_trackedDownloadService = trackedDownloadService ;
_trackedDownloadService = trackedDownloadService ;
_eventAggregator = eventAggregator ;
_eventAggregator = eventAggregator ;
_logger = logger ;
}
}
private void RemoveCompletedDownloads ( List < TrackedDownload > trackedDownloads )
private void RemoveCompletedDownloads ( List < TrackedDownload > trackedDownloads )
@ -42,6 +47,8 @@ namespace NzbDrone.Core.Download
var trackedDownloads = _trackedDownloadService . GetTrackedDownloads ( ) ;
var trackedDownloads = _trackedDownloadService . GetTrackedDownloads ( ) ;
foreach ( var trackedDownload in trackedDownloads )
foreach ( var trackedDownload in trackedDownloads )
{
try
{
{
if ( trackedDownload . State = = TrackedDownloadState . DownloadFailedPending )
if ( trackedDownload . State = = TrackedDownloadState . DownloadFailedPending )
{
{
@ -53,6 +60,11 @@ namespace NzbDrone.Core.Download
_completedDownloadService . Import ( trackedDownload ) ;
_completedDownloadService . Import ( trackedDownload ) ;
}
}
}
}
catch ( Exception e )
{
_logger . Debug ( e , "Failed to process download: {0}" , trackedDownload . DownloadItem . Title ) ;
}
}
if ( enableCompletedDownloadHandling & & _configService . RemoveCompletedDownloads )
if ( enableCompletedDownloadHandling & & _configService . RemoveCompletedDownloads )
{
{