private List <TrackedDownload> ProcessClientDownloads(IDownloadClient downloadClient)
        {
            List <DownloadClientItem> downloadClientHistory = new List <DownloadClientItem>();
            var trackedDownloads = new List <TrackedDownload>();

            try
            {
                downloadClientHistory = downloadClient.GetItems().ToList();
            }
            catch (Exception ex)
            {
                _logger.Warn(ex, "Unable to retrieve queue and history items from " + downloadClient.Definition.Name);
            }

            foreach (var downloadItem in downloadClientHistory)
            {
                var newItems = ProcessClientItems(downloadClient, downloadItem);
                trackedDownloads.AddRange(newItems);
            }

            if (_configService.EnableCompletedDownloadHandling && _configService.RemoveCompletedDownloads)
            {
                RemoveCompletedDownloads(trackedDownloads);
            }

            return(trackedDownloads);
        }
Exemple #2
0
        private List <TrackedDownload> ProcessClientDownloads(IDownloadClient downloadClient)
        {
            var downloadClientItems = new List <DownloadClientItem>();
            var trackedDownloads    = new List <TrackedDownload>();

            try
            {
                downloadClientItems = downloadClient.GetItems().ToList();

                _downloadClientStatusService.RecordSuccess(downloadClient.Definition.Id);
            }
            catch (Exception ex)
            {
                // TODO: Stop tracking items for the offline client
                _downloadClientStatusService.RecordFailure(downloadClient.Definition.Id);
                _logger.Warn(ex, "Unable to retrieve queue and history items from " + downloadClient.Definition.Name);
            }

            foreach (var downloadItem in downloadClientItems)
            {
                var item = ProcessClientItem(downloadClient, downloadItem);
                trackedDownloads.AddIfNotNull(item);
            }

            return(trackedDownloads);
        }