mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-17 21:26:22 -04:00
@@ -5,11 +5,11 @@ namespace NzbDrone.Core.Movies.Events
|
||||
{
|
||||
public class MoviesImportedEvent : IEvent
|
||||
{
|
||||
public List<int> MovieIds { get; private set; }
|
||||
public List<Movie> Movies { get; private set; }
|
||||
|
||||
public MoviesImportedEvent(List<int> movieIds)
|
||||
public MoviesImportedEvent(List<Movie> movies)
|
||||
{
|
||||
MovieIds = movieIds;
|
||||
Movies = movies;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Movies
|
||||
|
||||
public void Handle(MoviesImportedEvent message)
|
||||
{
|
||||
_commandQueueManager.PushMany(message.MovieIds.Select(s => new RefreshMovieCommand(new List<int> { s }, true)).ToList());
|
||||
_commandQueueManager.PushMany(message.Movies.Select(s => new RefreshMovieCommand(new List<int> { s.Id }, true)).ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace NzbDrone.Core.Movies
|
||||
{
|
||||
_movieRepository.InsertMany(newMovies);
|
||||
|
||||
_eventAggregator.PublishEvent(new MoviesImportedEvent(newMovies.Select(s => s.Id).ToList()));
|
||||
_eventAggregator.PublishEvent(new MoviesImportedEvent(newMovies));
|
||||
|
||||
return newMovies;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace NzbDrone.Core.Notifications
|
||||
IHandle<MovieImportedEvent>,
|
||||
IHandle<MoviesDeletedEvent>,
|
||||
IHandle<MovieAddedEvent>,
|
||||
IHandle<MoviesImportedEvent>,
|
||||
IHandle<MovieFileDeletedEvent>,
|
||||
IHandle<HealthCheckFailedEvent>,
|
||||
IHandle<UpdateInstalledEvent>,
|
||||
@@ -174,6 +175,27 @@ namespace NzbDrone.Core.Notifications
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(MoviesImportedEvent message)
|
||||
{
|
||||
foreach (var notification in _notificationFactory.OnMovieAddedEnabled())
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var movie in message.Movies)
|
||||
{
|
||||
if (ShouldHandleMovie(notification.Definition, movie))
|
||||
{
|
||||
notification.OnMovieAdded(movie);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Unable to send OnMovieAdded notification to: " + notification.Definition.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(MovieRenamedEvent message)
|
||||
{
|
||||
foreach (var notification in _notificationFactory.OnRenameEnabled())
|
||||
|
||||
Reference in New Issue
Block a user