TrackedDownload cache, queue etc now use DownloadId instead of TrackedId so it can be found purely by the id provided by the download client.

pull/3113/head
Taloth Saldono 10 years ago
parent 8b8b60f8b8
commit d67811b50a

@ -102,7 +102,7 @@ namespace NzbDrone.Api.Queue
throw new NotFoundException(); throw new NotFoundException();
} }
var trackedDownload = _trackedDownloadService.Find(queueItem.TrackingId); var trackedDownload = _trackedDownloadService.Find(queueItem.DownloadId);
if (trackedDownload == null) if (trackedDownload == null)
{ {

@ -21,6 +21,6 @@ namespace NzbDrone.Api.Queue
public String Status { get; set; } public String Status { get; set; }
public String TrackedDownloadStatus { get; set; } public String TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; } public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String TrackingId { get; set; } public String DownloadId { get; set; }
} }
} }

@ -6,7 +6,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads
{ {
public class TrackedDownload public class TrackedDownload
{ {
public String TrackingId { get; set; }
public Int32 DownloadClient { get; set; } public Int32 DownloadClient { get; set; }
public DownloadClientItem DownloadItem { get; set; } public DownloadClientItem DownloadItem { get; set; }
public TrackedDownloadStage State { get; set; } public TrackedDownloadStage State { get; set; }

@ -32,9 +32,9 @@ namespace NzbDrone.Core.Download.TrackedDownloads
_logger = logger; _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) public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, DownloadClientItem downloadItem)
@ -49,7 +49,6 @@ namespace NzbDrone.Core.Download.TrackedDownloads
var trackedDownload = new TrackedDownload var trackedDownload = new TrackedDownload
{ {
TrackingId = downloadClient.Id + "-" + downloadItem.DownloadId,
DownloadClient = downloadClient.Id, DownloadClient = downloadClient.Id,
DownloadItem = downloadItem, DownloadItem = downloadItem,
Protocol = downloadClient.Protocol Protocol = downloadClient.Protocol
@ -89,7 +88,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
trackedDownload.State = GetStateFromHistory(historyItem.EventType); trackedDownload.State = GetStateFromHistory(historyItem.EventType);
} }
_cache.Set(trackedDownload.TrackingId, trackedDownload); _cache.Set(trackedDownload.DownloadItem.DownloadId, trackedDownload);
return trackedDownload; return trackedDownload;
} }

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Queue
public String Status { get; set; } public String Status { get; set; }
public String TrackedDownloadStatus { get; set; } public String TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; } public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String TrackingId { get; set; } public String DownloadId { get; set; }
public RemoteEpisode RemoteEpisode { get; set; } public RemoteEpisode RemoteEpisode { get; set; }
} }
} }

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Queue
TrackedDownloadStatus = trackedDownload.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status.ToString(),
StatusMessages = trackedDownload.StatusMessages.ToList(), StatusMessages = trackedDownload.StatusMessages.ToList(),
RemoteEpisode = trackedDownload.RemoteEpisode, RemoteEpisode = trackedDownload.RemoteEpisode,
TrackingId = trackedDownload.TrackingId DownloadId = trackedDownload.DownloadItem.DownloadId
}; };
if (queue.Timeleft.HasValue) if (queue.Timeleft.HasValue)

Loading…
Cancel
Save