Fixed: Manually failing a release

pull/47/merge
Mark McDowall 11 years ago
parent 1ff652f6d6
commit fcd5619041

@ -1,6 +1,5 @@
using System; using System;
using System.IO; using System.IO;
using Newtonsoft.Json;
using NLog; using NLog;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;

@ -44,10 +44,10 @@ namespace NzbDrone.Core.Download
var downloadClientId = downloadClient.DownloadNzb(remoteEpisode); var downloadClientId = downloadClient.DownloadNzb(remoteEpisode);
var episodeGrabbedEvent = new EpisodeGrabbedEvent(remoteEpisode); var episodeGrabbedEvent = new EpisodeGrabbedEvent(remoteEpisode);
episodeGrabbedEvent.DownloadClient = downloadClient.GetType().Name;
if (!String.IsNullOrWhiteSpace(downloadClientId)) if (!String.IsNullOrWhiteSpace(downloadClientId))
{ {
episodeGrabbedEvent.DownloadClient = downloadClient.GetType().Name;
episodeGrabbedEvent.DownloadClientId = downloadClientId; episodeGrabbedEvent.DownloadClientId = downloadClientId;
} }

@ -132,14 +132,20 @@ namespace NzbDrone.Core.Download
private void PublishDownloadFailedEvent(List<History.History> historyItems, string message) private void PublishDownloadFailedEvent(List<History.History> historyItems, string message)
{ {
var historyItem = historyItems.First(); var historyItem = historyItems.First();
string downloadClient;
string downloadClientId;
historyItem.Data.TryGetValue(DOWNLOAD_CLIENT, out downloadClient);
historyItem.Data.TryGetValue(DOWNLOAD_CLIENT_ID, out downloadClientId);
_eventAggregator.PublishEvent(new DownloadFailedEvent _eventAggregator.PublishEvent(new DownloadFailedEvent
{ {
SeriesId = historyItem.SeriesId, SeriesId = historyItem.SeriesId,
EpisodeIds = historyItems.Select(h => h.EpisodeId).ToList(), EpisodeIds = historyItems.Select(h => h.EpisodeId).ToList(),
Quality = historyItem.Quality, Quality = historyItem.Quality,
SourceTitle = historyItem.SourceTitle, SourceTitle = historyItem.SourceTitle,
DownloadClient = historyItem.Data[DOWNLOAD_CLIENT], DownloadClient = downloadClient,
DownloadClientId = historyItem.Data[DOWNLOAD_CLIENT_ID], DownloadClientId = downloadClientId,
Message = message Message = message
}); });
} }

@ -103,10 +103,10 @@ namespace NzbDrone.Core.History
history.Data.Add("NzbInfoUrl", message.Episode.Release.InfoUrl); history.Data.Add("NzbInfoUrl", message.Episode.Release.InfoUrl);
history.Data.Add("ReleaseGroup", message.Episode.ParsedEpisodeInfo.ReleaseGroup); history.Data.Add("ReleaseGroup", message.Episode.ParsedEpisodeInfo.ReleaseGroup);
history.Data.Add("Age", message.Episode.Release.Age.ToString()); history.Data.Add("Age", message.Episode.Release.Age.ToString());
history.Data.Add("DownloadClient", message.DownloadClient);
if (!String.IsNullOrWhiteSpace(message.DownloadClientId)) if (!String.IsNullOrWhiteSpace(message.DownloadClientId))
{ {
history.Data.Add("DownloadClient", message.DownloadClient);
history.Data.Add("DownloadClientId", message.DownloadClientId); history.Data.Add("DownloadClientId", message.DownloadClientId);
} }

Loading…
Cancel
Save