mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
parent
a59928c66a
commit
69fcd8ec94
@ -5,11 +5,11 @@ namespace NzbDrone.Core.Movies.Events
|
|||||||
{
|
{
|
||||||
public class MoviesImportedEvent : IEvent
|
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 @@ public void Handle(MovieAddedEvent message)
|
|||||||
|
|
||||||
public void Handle(MoviesImportedEvent message)
|
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 @@ public List<Movie> AddMovies(List<Movie> newMovies)
|
|||||||
{
|
{
|
||||||
_movieRepository.InsertMany(newMovies);
|
_movieRepository.InsertMany(newMovies);
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new MoviesImportedEvent(newMovies.Select(s => s.Id).ToList()));
|
_eventAggregator.PublishEvent(new MoviesImportedEvent(newMovies));
|
||||||
|
|
||||||
return newMovies;
|
return newMovies;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public class NotificationService
|
|||||||
IHandle<MovieImportedEvent>,
|
IHandle<MovieImportedEvent>,
|
||||||
IHandle<MoviesDeletedEvent>,
|
IHandle<MoviesDeletedEvent>,
|
||||||
IHandle<MovieAddedEvent>,
|
IHandle<MovieAddedEvent>,
|
||||||
|
IHandle<MoviesImportedEvent>,
|
||||||
IHandle<MovieFileDeletedEvent>,
|
IHandle<MovieFileDeletedEvent>,
|
||||||
IHandle<HealthCheckFailedEvent>,
|
IHandle<HealthCheckFailedEvent>,
|
||||||
IHandle<UpdateInstalledEvent>,
|
IHandle<UpdateInstalledEvent>,
|
||||||
@ -174,6 +175,27 @@ public void Handle(MovieAddedEvent message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
public void Handle(MovieRenamedEvent message)
|
||||||
{
|
{
|
||||||
foreach (var notification in _notificationFactory.OnRenameEnabled())
|
foreach (var notification in _notificationFactory.OnRenameEnabled())
|
||||||
|
Loading…
Reference in New Issue
Block a user