mirror of
https://github.com/Sonarr/Sonarr
synced 2026-02-11 09:12:48 +01:00
Fixed: Manual import for unknown series items will properly mark as imported
This commit is contained in:
parent
4988655568
commit
d3bd90e4b9
5 changed files with 15 additions and 6 deletions
|
|
@ -141,7 +141,7 @@ public bool VerifyImport(TrackedDownload trackedDownload, List<ImportResult> imp
|
|||
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 @@ public bool VerifyImport(TrackedDownload trackedDownload, List<ImportResult> imp
|
|||
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 @@ private void RemoveCompletedDownloads()
|
|||
|
||||
foreach (var trackedDownload in trackedDownloads)
|
||||
{
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload,
|
||||
trackedDownload.RemoteEpisode.Series.Id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,12 @@ public DownloadHistory GetLatestDownloadHistoryItem(string downloadId)
|
|||
|
||||
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 @@ public void Handle(DownloadCompletedEvent message)
|
|||
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 @@ public void Execute(ManualImportCommand message)
|
|||
if (allEpisodesImported)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, imported.First().ImportDecision.LocalEpisode.Series.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue