mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Fixed: Manual import for unknown series items will properly mark as imported
This commit is contained in:
@@ -141,7 +141,7 @@ namespace NzbDrone.Core.Download
|
||||
if (allEpisodesImported)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace NzbDrone.Core.Download
|
||||
if (allEpisodesImportedInHistory)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ namespace NzbDrone.Core.Download
|
||||
public class DownloadCompletedEvent : IEvent
|
||||
{
|
||||
public TrackedDownload TrackedDownload { get; private set; }
|
||||
public int SeriesId { get; set; }
|
||||
|
||||
public DownloadCompletedEvent(TrackedDownload trackedDownload)
|
||||
public DownloadCompletedEvent(TrackedDownload trackedDownload, int seriesId)
|
||||
{
|
||||
TrackedDownload = trackedDownload;
|
||||
SeriesId = seriesId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,8 @@ namespace NzbDrone.Core.Download
|
||||
|
||||
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)
|
||||
{
|
||||
// Don't store grabbed events for clients that don't download IDs
|
||||
if (message.DownloadId.IsNullOrWhiteSpace())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var history = new DownloadHistory
|
||||
{
|
||||
EventType = DownloadHistoryEventType.DownloadGrabbed,
|
||||
@@ -155,7 +161,7 @@ namespace NzbDrone.Core.Download.History
|
||||
var history = new DownloadHistory
|
||||
{
|
||||
EventType = DownloadHistoryEventType.DownloadImported,
|
||||
SeriesId = message.TrackedDownload.RemoteEpisode.Series.Id,
|
||||
SeriesId = message.SeriesId,
|
||||
DownloadId = message.TrackedDownload.DownloadItem.DownloadId,
|
||||
SourceTitle = message.TrackedDownload.DownloadItem.OutputPath.ToString(),
|
||||
Date = DateTime.UtcNow,
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
|
||||
if (allEpisodesImported)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, imported.First().ImportDecision.LocalEpisode.Series.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user