1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

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

This commit is contained in:
Taloth Saldono 2015-01-22 01:27:07 +01:00
parent 8b8b60f8b8
commit d67811b50a
6 changed files with 7 additions and 9 deletions

View File

@ -102,7 +102,7 @@ private TrackedDownload GetTrackedDownload(int queueId)
throw new NotFoundException();
}
var trackedDownload = _trackedDownloadService.Find(queueItem.TrackingId);
var trackedDownload = _trackedDownloadService.Find(queueItem.DownloadId);
if (trackedDownload == null)
{

View File

@ -21,6 +21,6 @@ public class QueueResource : RestResource
public String Status { get; set; }
public String TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String TrackingId { get; set; }
public String DownloadId { get; set; }
}
}

View File

@ -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; }

View File

@ -32,9 +32,9 @@ public TrackedDownloadService(IParsingService parsingService,
_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 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
var trackedDownload = new TrackedDownload
{
TrackingId = downloadClient.Id + "-" + downloadItem.DownloadId,
DownloadClient = downloadClient.Id,
DownloadItem = downloadItem,
Protocol = downloadClient.Protocol
@ -89,7 +88,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
trackedDownload.State = GetStateFromHistory(historyItem.EventType);
}
_cache.Set(trackedDownload.TrackingId, trackedDownload);
_cache.Set(trackedDownload.DownloadItem.DownloadId, trackedDownload);
return trackedDownload;
}

View File

@ -21,7 +21,7 @@ public class Queue : ModelBase
public String Status { get; set; }
public String TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String TrackingId { get; set; }
public String DownloadId { get; set; }
public RemoteEpisode RemoteEpisode { get; set; }
}
}

View File

@ -59,7 +59,7 @@ private IEnumerable<Queue> MapQueue(TrackedDownload trackedDownload)
TrackedDownloadStatus = trackedDownload.Status.ToString(),
StatusMessages = trackedDownload.StatusMessages.ToList(),
RemoteEpisode = trackedDownload.RemoteEpisode,
TrackingId = trackedDownload.TrackingId
DownloadId = trackedDownload.DownloadItem.DownloadId
};
if (queue.Timeleft.HasValue)