diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index b157012d3..d22589c37 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -235,8 +235,6 @@ namespace NzbDrone.Core.Download var atLeastOneEpisodeImported = importResults.Any(c => c.Result == ImportResultType.Imported); var allEpisodesImportedInHistory = _trackedDownloadAlreadyImported.IsImported(trackedDownload, historyItems); - var episodes = _episodeService.GetEpisodes(trackedDownload.RemoteEpisode.Episodes.Select(e => e.Id)); - var files = _mediaFileService.GetFiles(episodes.Select(e => e.EpisodeFileId).Distinct()); if (allEpisodesImportedInHistory) { @@ -259,6 +257,9 @@ namespace NzbDrone.Core.Download .Write(); } + var episodes = _episodeService.GetEpisodes(trackedDownload.RemoteEpisode.Episodes.Select(e => e.Id)); + var files = _mediaFileService.GetFiles(episodes.Select(e => e.EpisodeFileId).Where(i => i > 0).Distinct()); + trackedDownload.State = TrackedDownloadState.Imported; _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id, files, releaseInfo));