diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 9fa38e029..7abc68c66 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -123,7 +123,7 @@ namespace NzbDrone.Core.Download if (allTracksImported) { trackedDownload.State = TrackedDownloadState.Imported; - _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); + _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteAlbum.Artist.Id)); return; } @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Download if (allTracksImportedInHistory) { trackedDownload.State = TrackedDownloadState.Imported; - _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); + _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteAlbum.Artist.Id)); return; } } diff --git a/src/NzbDrone.Core/Download/DownloadCompletedEvent.cs b/src/NzbDrone.Core/Download/DownloadCompletedEvent.cs index 0957ed860..cce9a6e4b 100644 --- a/src/NzbDrone.Core/Download/DownloadCompletedEvent.cs +++ b/src/NzbDrone.Core/Download/DownloadCompletedEvent.cs @@ -1,4 +1,4 @@ -using NzbDrone.Common.Messaging; +using NzbDrone.Common.Messaging; using NzbDrone.Core.Download.TrackedDownloads; namespace NzbDrone.Core.Download @@ -6,10 +6,12 @@ namespace NzbDrone.Core.Download public class DownloadCompletedEvent : IEvent { public TrackedDownload TrackedDownload { get; private set; } + public int ArtistId { get; set; } - public DownloadCompletedEvent(TrackedDownload trackedDownload) + public DownloadCompletedEvent(TrackedDownload trackedDownload, int artistId) { TrackedDownload = trackedDownload; + ArtistId = artistId; } } } diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Manual/ManualImportService.cs index 89508947d..33f949e73 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Manual/ManualImportService.cs @@ -370,6 +370,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual foreach (var groupedTrackedDownload in importedTrackedDownload.GroupBy(i => i.TrackedDownload.DownloadItem.DownloadId).ToList()) { var trackedDownload = groupedTrackedDownload.First().TrackedDownload; + var importArtist = groupedTrackedDownload.First().ImportResult.ImportDecision.Item.Artist; var outputPath = trackedDownload.ImportItem.OutputPath.FullPath; @@ -377,7 +378,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual { if (_downloadedTracksImportService.ShouldDeleteFolder( _diskProvider.GetDirectoryInfo(outputPath), - trackedDownload.RemoteAlbum.Artist) && trackedDownload.DownloadItem.CanMoveFiles) + importArtist) && trackedDownload.DownloadItem.CanMoveFiles) { _diskProvider.DeleteFolder(outputPath, true); } @@ -386,7 +387,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Manual if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= Math.Max(1, trackedDownload.RemoteAlbum.Albums.Count)) { trackedDownload.State = TrackedDownloadState.Imported; - _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload)); + _eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importArtist.Id)); } } }