Fixed: Manual import for unknown series items will properly mark as imported

pull/3789/head
Mark McDowall 4 years ago
parent 4988655568
commit d3bd90e4b9

@ -141,7 +141,7 @@ namespace NzbDrone.Core.Download
if (allEpisodesImported) if (allEpisodesImported)
{ {
trackedDownload.State = TrackedDownloadState.Imported; trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
return true; return true;
} }
@ -165,7 +165,7 @@ namespace NzbDrone.Core.Download
if (allEpisodesImportedInHistory) if (allEpisodesImportedInHistory)
{ {
trackedDownload.State = TrackedDownloadState.Imported; trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
return true; return true;
} }
} }

@ -6,10 +6,12 @@ namespace NzbDrone.Core.Download
public class DownloadCompletedEvent : IEvent public class DownloadCompletedEvent : IEvent
{ {
public TrackedDownload TrackedDownload { get; private set; } public TrackedDownload TrackedDownload { get; private set; }
public int SeriesId { get; set; }
public DownloadCompletedEvent(TrackedDownload trackedDownload) public DownloadCompletedEvent(TrackedDownload trackedDownload, int seriesId)
{ {
TrackedDownload = trackedDownload; TrackedDownload = trackedDownload;
SeriesId = seriesId;
} }
} }
} }

@ -41,7 +41,8 @@ namespace NzbDrone.Core.Download
foreach (var trackedDownload in trackedDownloads) foreach (var trackedDownload in trackedDownloads)
{ {
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload,
trackedDownload.RemoteEpisode.Series.Id));
} }
} }

@ -88,6 +88,12 @@ namespace NzbDrone.Core.Download.History
public void Handle(EpisodeGrabbedEvent message) public void Handle(EpisodeGrabbedEvent message)
{ {
// Don't store grabbed events for clients that don't download IDs
if (message.DownloadId.IsNullOrWhiteSpace())
{
return;
}
var history = new DownloadHistory var history = new DownloadHistory
{ {
EventType = DownloadHistoryEventType.DownloadGrabbed, EventType = DownloadHistoryEventType.DownloadGrabbed,
@ -155,7 +161,7 @@ namespace NzbDrone.Core.Download.History
var history = new DownloadHistory var history = new DownloadHistory
{ {
EventType = DownloadHistoryEventType.DownloadImported, EventType = DownloadHistoryEventType.DownloadImported,
SeriesId = message.TrackedDownload.RemoteEpisode.Series.Id, SeriesId = message.SeriesId,
DownloadId = message.TrackedDownload.DownloadItem.DownloadId, DownloadId = message.TrackedDownload.DownloadItem.DownloadId,
SourceTitle = message.TrackedDownload.DownloadItem.OutputPath.ToString(), SourceTitle = message.TrackedDownload.DownloadItem.OutputPath.ToString(),
Date = DateTime.UtcNow, Date = DateTime.UtcNow,

@ -372,7 +372,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
if (allEpisodesImported) if (allEpisodesImported)
{ {
trackedDownload.State = TrackedDownloadState.Imported; trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, imported.First().ImportDecision.LocalEpisode.Series.Id));
} }
} }
} }

Loading…
Cancel
Save