mirror of https://github.com/Radarr/Radarr
Fixed: Manual Imports for Unknown Movies
Fixes RADARR-Z Fixes RADARR-1E Fixes #4379
This commit is contained in:
parent
1d6a7a1843
commit
ba6ba06d9b
|
@ -138,7 +138,7 @@ namespace NzbDrone.Core.Download
|
|||
if (allMoviesImported)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteMovie.Movie.Id));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace NzbDrone.Core.Download
|
|||
if (allMoviesImportedInHistory)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadState.Imported;
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteMovie.Movie.Id));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ namespace NzbDrone.Core.Download
|
|||
public class DownloadCompletedEvent : IEvent
|
||||
{
|
||||
public TrackedDownload TrackedDownload { get; private set; }
|
||||
public int MovieId { get; set; }
|
||||
|
||||
public DownloadCompletedEvent(TrackedDownload trackedDownload)
|
||||
public DownloadCompletedEvent(TrackedDownload trackedDownload, int movieId)
|
||||
{
|
||||
TrackedDownload = trackedDownload;
|
||||
MovieId = movieId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Download
|
|||
|
||||
foreach (var trackedDownload in trackedDownloads)
|
||||
{
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload));
|
||||
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteMovie.Movie.Id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,12 @@ namespace NzbDrone.Core.Download.History
|
|||
|
||||
public void Handle(MovieGrabbedEvent 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,
|
||||
|
@ -149,7 +155,7 @@ namespace NzbDrone.Core.Download.History
|
|||
var history = new DownloadHistory
|
||||
{
|
||||
EventType = DownloadHistoryEventType.DownloadImported,
|
||||
MovieId = message.TrackedDownload.RemoteMovie.Movie.Id,
|
||||
MovieId = message.MovieId,
|
||||
DownloadId = message.TrackedDownload.DownloadItem.DownloadId,
|
||||
SourceTitle = message.TrackedDownload.DownloadItem.OutputPath.ToString(),
|
||||
Date = DateTime.UtcNow,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue