|
|
|
@ -301,21 +301,22 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual
|
|
|
|
|
{
|
|
|
|
|
var trackedDownload = groupedTrackedDownload.First().TrackedDownload;
|
|
|
|
|
|
|
|
|
|
var importMovie = groupedTrackedDownload.First().ImportResult.ImportDecision.LocalMovie.Movie;
|
|
|
|
|
|
|
|
|
|
if (_diskProvider.FolderExists(trackedDownload.DownloadItem.OutputPath.FullPath))
|
|
|
|
|
{
|
|
|
|
|
if (_downloadedMovieImportService.ShouldDeleteFolder(
|
|
|
|
|
new DirectoryInfo(trackedDownload.DownloadItem.OutputPath.FullPath),
|
|
|
|
|
trackedDownload.RemoteMovie.Movie) && trackedDownload.DownloadItem.CanMoveFiles)
|
|
|
|
|
importMovie) && trackedDownload.DownloadItem.CanMoveFiles)
|
|
|
|
|
{
|
|
|
|
|
_diskProvider.DeleteFolder(trackedDownload.DownloadItem.OutputPath.FullPath, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: trackedDownload.RemoteMovie.Movie.Count is always 1?
|
|
|
|
|
if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= Math.Max(1, 1))
|
|
|
|
|
if (groupedTrackedDownload.Select(c => c.ImportResult).Count(c => c.Result == ImportResultType.Imported) >= 1)
|
|
|
|
|
{
|
|
|
|
|
trackedDownload.State = TrackedDownloadState.Imported;
|
|
|
|
|
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
|
|
|
|
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, importMovie.Id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|