1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed manual import possible null series

This commit is contained in:
Mark McDowall 2020-05-30 10:12:24 -07:00
parent 7ea45bb714
commit e2644c3847

View File

@ -353,12 +353,13 @@ public void Execute(ManualImportCommand message)
foreach (var groupedTrackedDownload in importedTrackedDownload.GroupBy(i => i.TrackedDownload.DownloadItem.DownloadId).ToList())
{
var trackedDownload = groupedTrackedDownload.First().TrackedDownload;
var importedSeries = imported.First().ImportDecision.LocalEpisode.Series;
if (_diskProvider.FolderExists(trackedDownload.DownloadItem.OutputPath.FullPath))
{
if (_downloadedEpisodesImportService.ShouldDeleteFolder(
new DirectoryInfo(trackedDownload.DownloadItem.OutputPath.FullPath),
trackedDownload.RemoteEpisode.Series) && trackedDownload.DownloadItem.CanMoveFiles)
new DirectoryInfo(trackedDownload.DownloadItem.OutputPath.FullPath), importedSeries) &&
trackedDownload.DownloadItem.CanMoveFiles)
{
_diskProvider.DeleteFolder(trackedDownload.DownloadItem.OutputPath.FullPath, true);
}
@ -372,7 +373,7 @@ public void Execute(ManualImportCommand message)
if (allEpisodesImported)
{
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, imported.First().ImportDecision.LocalEpisode.Series.Id));
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importedSeries.Id));
}
}
}