mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-26 22:46:53 -04:00
New: Add OnDelete Notification to TraktConnection
to remove movies from Trakt Collection when they are removed from Radarr Add OnDelete Notification to TraktConnection to remove movies from Trakt Collection when they are removed from Radarr skip the deleteHandler if the delete Event was triggered for reason: Upgrade change migration from 180 to 182 since 180 and 181 are already in plan to be used address comments regarding helpText for OnDelete and move check for OnUpgrade deletion reason into trakt connection OnDelete handler reuse TraktCollectMoviesResource for OnDelete trakt api should just ignore the other properties anyway add WithDefaultValue to migration add unit test case for onDelete to fix unit testcase for onDelete
This commit is contained in:
@@ -16,7 +16,8 @@ namespace NzbDrone.Core.Notifications
|
||||
: IHandle<MovieRenamedEvent>,
|
||||
IHandle<MovieGrabbedEvent>,
|
||||
IHandle<MovieDownloadedEvent>,
|
||||
IHandle<HealthCheckFailedEvent>
|
||||
IHandle<HealthCheckFailedEvent>,
|
||||
IHandle<MovieFileDeletedEvent>
|
||||
{
|
||||
private readonly INotificationFactory _notificationFactory;
|
||||
private readonly Logger _logger;
|
||||
@@ -172,5 +173,29 @@ namespace NzbDrone.Core.Notifications
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
var deleteMessage = new DeleteMessage();
|
||||
deleteMessage.Message = GetMessage(message.MovieFile.Movie, message.MovieFile.Quality);
|
||||
deleteMessage.MovieFile = message.MovieFile;
|
||||
deleteMessage.Movie = message.MovieFile.Movie;
|
||||
deleteMessage.Reason = message.Reason;
|
||||
|
||||
foreach (var notification in _notificationFactory.OnDeleteEnabled())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ShouldHandleMovie(notification.Definition, message.MovieFile.Movie))
|
||||
{
|
||||
notification.OnDelete(deleteMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Unable to send OnDelete notification to: " + notification.Definition.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user