From d67811b50a60a23445596d6f19a39f152266844d Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 22 Jan 2015 01:27:07 +0100 Subject: [PATCH] TrackedDownload cache, queue etc now use DownloadId instead of TrackedId so it can be found purely by the id provided by the download client. --- src/NzbDrone.Api/Queue/QueueActionModule.cs | 2 +- src/NzbDrone.Api/Queue/QueueResource.cs | 2 +- .../Download/TrackedDownloads/TrackedDownload.cs | 1 - .../Download/TrackedDownloads/TrackedDownloadService.cs | 7 +++---- src/NzbDrone.Core/Queue/Queue.cs | 2 +- src/NzbDrone.Core/Queue/QueueService.cs | 2 +- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Api/Queue/QueueActionModule.cs b/src/NzbDrone.Api/Queue/QueueActionModule.cs index c3b94bbda..8b0d7621e 100644 --- a/src/NzbDrone.Api/Queue/QueueActionModule.cs +++ b/src/NzbDrone.Api/Queue/QueueActionModule.cs @@ -102,7 +102,7 @@ namespace NzbDrone.Api.Queue throw new NotFoundException(); } - var trackedDownload = _trackedDownloadService.Find(queueItem.TrackingId); + var trackedDownload = _trackedDownloadService.Find(queueItem.DownloadId); if (trackedDownload == null) { diff --git a/src/NzbDrone.Api/Queue/QueueResource.cs b/src/NzbDrone.Api/Queue/QueueResource.cs index 78200089d..7719b2860 100644 --- a/src/NzbDrone.Api/Queue/QueueResource.cs +++ b/src/NzbDrone.Api/Queue/QueueResource.cs @@ -21,6 +21,6 @@ namespace NzbDrone.Api.Queue public String Status { get; set; } public String TrackedDownloadStatus { get; set; } public List StatusMessages { get; set; } - public String TrackingId { get; set; } + public String DownloadId { get; set; } } } diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs index e9a41eec2..9bc80de4f 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs @@ -6,7 +6,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads { public class TrackedDownload { - public String TrackingId { get; set; } public Int32 DownloadClient { get; set; } public DownloadClientItem DownloadItem { get; set; } public TrackedDownloadStage State { get; set; } diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index d158b69a2..bb34adbe7 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -32,9 +32,9 @@ namespace NzbDrone.Core.Download.TrackedDownloads _logger = logger; } - public TrackedDownload Find(string trackingId) + public TrackedDownload Find(string downloadId) { - return _cache.Find(trackingId); + return _cache.Find(downloadId); } public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, DownloadClientItem downloadItem) @@ -49,7 +49,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads var trackedDownload = new TrackedDownload { - TrackingId = downloadClient.Id + "-" + downloadItem.DownloadId, DownloadClient = downloadClient.Id, DownloadItem = downloadItem, Protocol = downloadClient.Protocol @@ -89,7 +88,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads trackedDownload.State = GetStateFromHistory(historyItem.EventType); } - _cache.Set(trackedDownload.TrackingId, trackedDownload); + _cache.Set(trackedDownload.DownloadItem.DownloadId, trackedDownload); return trackedDownload; } diff --git a/src/NzbDrone.Core/Queue/Queue.cs b/src/NzbDrone.Core/Queue/Queue.cs index 1f8746b18..3e833f6a3 100644 --- a/src/NzbDrone.Core/Queue/Queue.cs +++ b/src/NzbDrone.Core/Queue/Queue.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Queue public String Status { get; set; } public String TrackedDownloadStatus { get; set; } public List StatusMessages { get; set; } - public String TrackingId { get; set; } + public String DownloadId { get; set; } public RemoteEpisode RemoteEpisode { get; set; } } } diff --git a/src/NzbDrone.Core/Queue/QueueService.cs b/src/NzbDrone.Core/Queue/QueueService.cs index 4ee499f9d..0a4a0bb65 100644 --- a/src/NzbDrone.Core/Queue/QueueService.cs +++ b/src/NzbDrone.Core/Queue/QueueService.cs @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Queue TrackedDownloadStatus = trackedDownload.Status.ToString(), StatusMessages = trackedDownload.StatusMessages.ToList(), RemoteEpisode = trackedDownload.RemoteEpisode, - TrackingId = trackedDownload.TrackingId + DownloadId = trackedDownload.DownloadItem.DownloadId }; if (queue.Timeleft.HasValue)