Fix History not picking up imported movie.

pull/2/head
Leonardo Galli 8 years ago
parent 8fa43fb9f7
commit eb46343ce8

@ -31,6 +31,7 @@ namespace NzbDrone.Core.History
public class HistoryService : IHistoryService,
IHandle<EpisodeGrabbedEvent>,
IHandle<MovieGrabbedEvent>,
IHandle<MovieImportedEvent>,
IHandle<EpisodeImportedEvent>,
IHandle<DownloadFailedEvent>,
IHandle<EpisodeFileDeletedEvent>,
@ -264,6 +265,45 @@ namespace NzbDrone.Core.History
}
}
public void Handle(MovieImportedEvent message)
{
if (!message.NewDownload)
{
return;
}
var downloadId = message.DownloadId;
if (downloadId.IsNullOrWhiteSpace())
{
//downloadId = FindDownloadId(message); For now fuck off.
}
var movie = message.MovieInfo.Movie;
var history = new History
{
EventType = HistoryEventType.DownloadFolderImported,
Date = DateTime.UtcNow,
Quality = message.MovieInfo.Quality,
SourceTitle = movie.Title,
SeriesId = 0,
EpisodeId = 0,
DownloadId = downloadId,
MovieId = movie.Id,
};
//Won't have a value since we publish this event before saving to DB.
//history.Data.Add("FileId", message.ImportedEpisode.Id.ToString());
history.Data.Add("DroppedPath", message.MovieInfo.Path);
history.Data.Add("ImportedPath", Path.Combine(movie.Path, message.ImportedMovie.RelativePath));
history.Data.Add("DownloadClient", message.DownloadClient);
_historyRepository.Insert(history);
}
public void Handle(DownloadFailedEvent message)
{
foreach (var episodeId in message.EpisodeIds)

Loading…
Cancel
Save