diff --git a/frontend/src/Settings/Notifications/Notifications/Notification.js b/frontend/src/Settings/Notifications/Notifications/Notification.js
index b30b19716..d571545f0 100644
--- a/frontend/src/Settings/Notifications/Notifications/Notification.js
+++ b/frontend/src/Settings/Notifications/Notifications/Notification.js
@@ -59,13 +59,17 @@ class Notification extends Component {
onDownload,
onUpgrade,
onRename,
- onDelete,
+ onMovieDelete,
+ onMovieFileDelete,
+ onMovieFileDeleteForUpgrade,
onHealthIssue,
supportsOnGrab,
supportsOnDownload,
supportsOnUpgrade,
supportsOnRename,
- supportsOnDelete,
+ supportsOnMovieDelete,
+ supportsOnMovieFileDelete,
+ supportsOnMovieFileDeleteForUpgrade,
supportsOnHealthIssue
} = this.props;
@@ -80,55 +84,78 @@ class Notification extends Component {
{
- supportsOnGrab && onGrab &&
+ supportsOnGrab && onGrab ?
+ :
+ null
}
{
- supportsOnDelete && onDelete &&
-
- }
-
- {
- supportsOnDownload && onDownload &&
+ supportsOnDownload && onDownload ?
+ :
+ null
}
{
- supportsOnUpgrade && onDownload && onUpgrade &&
+ supportsOnUpgrade && onDownload && onUpgrade ?
+ :
+ null
}
{
- supportsOnRename && onRename &&
+ supportsOnRename && onRename ?
+ :
+ null
}
{
- supportsOnHealthIssue && onHealthIssue &&
+ supportsOnHealthIssue && onHealthIssue ?
+ :
+ null
}
{
- !onGrab && !onDownload && !onRename && !onHealthIssue && !onDelete &&
+ supportsOnMovieDelete && onMovieDelete ?
+ :
+ null
+ }
+
+ {
+ supportsOnMovieFileDelete && onMovieFileDelete ?
+ :
+ null
+ }
+
+ {
+ supportsOnMovieFileDeleteForUpgrade && onMovieFileDelete && onMovieFileDeleteForUpgrade ?
+ :
+ null
+ }
+
+ {
+ !onGrab && !onDownload && !onRename && !onHealthIssue && !onMovieDelete && !onMovieFileDelete ?
+ :
+ null
}
+
+
+
+
+ {
+ onMovieFileDelete.value &&
+
+
+
+ }
+
public bool OnDownload { get; set; }
public bool OnUpgrade { get; set; }
public bool OnRename { get; set; }
- public bool OnDelete { get; set; }
+ public bool OnMovieDelete { get; set; }
+ public bool OnMovieFileDelete { get; set; }
+ public bool OnMovieFileDeleteForUpgrade { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnDownload { get; set; }
public bool SupportsOnUpgrade { get; set; }
public bool SupportsOnRename { get; set; }
- public bool SupportsOnDelete { get; set; }
+ public bool SupportsOnMovieDelete { get; set; }
+ public bool SupportsOnMovieFileDelete { get; set; }
+ public bool SupportsOnMovieFileDeleteForUpgrade { get; set; }
public HashSet Tags { get; set; }
}
}
diff --git a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
index 7ed370e84..e8ba8551a 100644
--- a/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
+++ b/src/NzbDrone.Core.Test/NotificationTests/NotificationBaseFixture.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using FluentAssertions;
using FluentValidation.Results;
using NUnit.Framework;
@@ -62,9 +62,14 @@ public override void OnMovieRename(Movie movie)
TestLogger.Info("OnRename was called");
}
- public override void OnDelete(DeleteMessage message)
+ public override void OnMovieFileDelete(MovieFileDeleteMessage message)
{
- TestLogger.Info("OnDelete was called");
+ TestLogger.Info("OnMovieFileDelete was called");
+ }
+
+ public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
+ {
+ TestLogger.Info("OnMovieDelete was called");
}
public override void OnHealthIssue(NzbDrone.Core.HealthCheck.HealthCheck artist)
@@ -105,7 +110,9 @@ public void should_support_all_if_implemented()
notification.SupportsOnDownload.Should().BeTrue();
notification.SupportsOnUpgrade.Should().BeTrue();
notification.SupportsOnRename.Should().BeTrue();
- notification.SupportsOnDelete.Should().BeTrue();
+ notification.SupportsOnMovieDelete.Should().BeTrue();
+ notification.SupportsOnMovieFileDelete.Should().BeTrue();
+ notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeTrue();
notification.SupportsOnHealthIssue.Should().BeTrue();
}
@@ -118,7 +125,9 @@ public void should_support_none_if_none_are_implemented()
notification.SupportsOnDownload.Should().BeFalse();
notification.SupportsOnUpgrade.Should().BeFalse();
notification.SupportsOnRename.Should().BeFalse();
- notification.SupportsOnDelete.Should().BeFalse();
+ notification.SupportsOnMovieDelete.Should().BeFalse();
+ notification.SupportsOnMovieFileDelete.Should().BeFalse();
+ notification.SupportsOnMovieFileDeleteForUpgrade.Should().BeFalse();
notification.SupportsOnHealthIssue.Should().BeFalse();
}
}
diff --git a/src/NzbDrone.Core/Datastore/Migration/192_add_on_delete_to_notifications.cs b/src/NzbDrone.Core/Datastore/Migration/192_add_on_delete_to_notifications.cs
new file mode 100644
index 000000000..3c1f0a252
--- /dev/null
+++ b/src/NzbDrone.Core/Datastore/Migration/192_add_on_delete_to_notifications.cs
@@ -0,0 +1,16 @@
+using FluentMigrator;
+using NzbDrone.Core.Datastore.Migration.Framework;
+
+namespace NzbDrone.Core.Datastore.Migration
+{
+ [Migration(192)]
+ public class add_on_delete_to_notifications : NzbDroneMigrationBase
+ {
+ protected override void MainDbUpgrade()
+ {
+ Rename.Column("OnDelete").OnTable("Notifications").To("OnMovieDelete");
+ Alter.Table("Notifications").AddColumn("OnMovieFileDelete").AsBoolean().WithDefaultValue(0);
+ Alter.Table("Notifications").AddColumn("OnMovieFileDeleteForUpgrade").AsBoolean().WithDefaultValue(0);
+ }
+ }
+}
diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs
index 1014d4bae..833e739fc 100644
--- a/src/NzbDrone.Core/Datastore/TableMapping.cs
+++ b/src/NzbDrone.Core/Datastore/TableMapping.cs
@@ -87,7 +87,9 @@ public static void Map()
.Ignore(i => i.SupportsOnDownload)
.Ignore(i => i.SupportsOnUpgrade)
.Ignore(i => i.SupportsOnRename)
- .Ignore(i => i.SupportsOnDelete)
+ .Ignore(i => i.SupportsOnMovieDelete)
+ .Ignore(i => i.SupportsOnMovieFileDelete)
+ .Ignore(i => i.SupportsOnMovieFileDeleteForUpgrade)
.Ignore(i => i.SupportsOnHealthIssue);
Mapper.Entity("Metadata").RegisterModel()
diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json
index 9acbc06d7..6b83bf55c 100644
--- a/src/NzbDrone.Core/Localization/Core/en.json
+++ b/src/NzbDrone.Core/Localization/Core/en.json
@@ -612,8 +612,6 @@
"NoVideoFilesFoundSelectedFolder": "No video files were found in the selected folder",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok",
- "OnDelete": "On Delete",
- "OnDeleteHelpText": "On Delete",
"OnDownloadHelpText": "On Import",
"OnGrab": "On Grab",
"OnGrabHelpText": "On Grab",
@@ -623,8 +621,15 @@
"OnLatestVersion": "The latest version of Radarr is already installed",
"OnlyTorrent": "Only Torrent",
"OnlyUsenet": "Only Usenet",
+ "OnMovieDelete": "On Movie Delete",
+ "OnMovieDeleteHelpText": "On Movie Delete",
+ "OnMovieFileDelete": "On Movie File Delete",
+ "OnMovieFileDeleteHelpText": "On Movie File Delete",
+ "OnMovieFileDeleteForUpgrade": "On Movie File Delete For Upgrade",
+ "OnMovieFileDeleteForUpgradeHelpText": "On Movie File Delete For Upgrade",
"OnRename": "On Rename",
"OnRenameHelpText": "On Rename",
+ "OnUpgrade": "On Upgrade",
"OnUpgradeHelpText": "On Upgrade",
"OpenBrowserOnStart": "Open browser on start",
"OpenThisModal": "Open This Modal",
diff --git a/src/NzbDrone.Core/MediaFiles/Events/DeleteCompletedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/DeleteCompletedEvent.cs
new file mode 100644
index 000000000..f987bc1c2
--- /dev/null
+++ b/src/NzbDrone.Core/MediaFiles/Events/DeleteCompletedEvent.cs
@@ -0,0 +1,8 @@
+using NzbDrone.Common.Messaging;
+
+namespace NzbDrone.Core.MediaFiles.Events
+{
+ public class DeleteCompletedEvent : IEvent
+ {
+ }
+}
diff --git a/src/NzbDrone.Core/MediaFiles/MediaFileDeletionService.cs b/src/NzbDrone.Core/MediaFiles/MediaFileDeletionService.cs
index c23ef9f91..32f5cdd77 100644
--- a/src/NzbDrone.Core/MediaFiles/MediaFileDeletionService.cs
+++ b/src/NzbDrone.Core/MediaFiles/MediaFileDeletionService.cs
@@ -28,6 +28,7 @@ public class MediaFileDeletionService : IDeleteMediaFiles,
private readonly IMediaFileService _mediaFileService;
private readonly IMovieService _movieService;
private readonly IConfigService _configService;
+ private readonly IEventAggregator _eventAggregator;
private readonly Logger _logger;
public MediaFileDeletionService(IDiskProvider diskProvider,
@@ -35,6 +36,7 @@ public MediaFileDeletionService(IDiskProvider diskProvider,
IMediaFileService mediaFileService,
IMovieService movieService,
IConfigService configService,
+ IEventAggregator eventAggregator,
Logger logger)
{
_diskProvider = diskProvider;
@@ -42,6 +44,7 @@ public MediaFileDeletionService(IDiskProvider diskProvider,
_mediaFileService = mediaFileService;
_movieService = movieService;
_configService = configService;
+ _eventAggregator = eventAggregator;
_logger = logger;
}
@@ -81,6 +84,8 @@ public void DeleteMovieFile(Movie movie, MovieFile movieFile)
// Delete the movie file from the database to clean it up even if the file was already deleted
_mediaFileService.Delete(movieFile, DeleteMediaFileReason.Manual);
+
+ _eventAggregator.PublishEvent(new DeleteCompletedEvent());
}
public void HandleAsync(MoviesDeletedEvent message)
@@ -116,6 +121,8 @@ public void HandleAsync(MoviesDeletedEvent message)
_recycleBinProvider.DeleteFolder(movie.Path);
}
}
+
+ _eventAggregator.PublishEvent(new DeleteCompletedEvent());
}
}
diff --git a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
index b2fc8ec1c..5bed87b59 100644
--- a/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
+++ b/src/NzbDrone.Core/Notifications/Boxcar/Boxcar.cs
@@ -26,6 +26,16 @@ public override void OnDownload(DownloadMessage message)
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings);
}
+ public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
+ {
+ _proxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
+ }
+
+ public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
+ {
+ _proxy.SendNotification(MOVIE_DELETED_TITLE, deleteMessage.Message, Settings);
+ }
+
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);
diff --git a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
index a34601e21..5731b1f0f 100755
--- a/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
+++ b/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
@@ -117,6 +117,55 @@ public override void OnMovieRename(Movie movie)
ExecuteScript(environmentVariables);
}
+ public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
+ {
+ var movie = deleteMessage.Movie;
+ var movieFile = deleteMessage.MovieFile;
+
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Radarr_EventType", "MovieFileDelete");
+ environmentVariables.Add("Radarr_MovieFile_DeleteReason", deleteMessage.Reason.ToString());
+ environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
+ environmentVariables.Add("Radarr_Movie_Title", movie.Title);
+ environmentVariables.Add("Radarr_Movie_Year", movie.Year.ToString());
+ environmentVariables.Add("Radarr_Movie_Path", movie.Path);
+ environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId ?? string.Empty);
+ environmentVariables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
+ environmentVariables.Add("Radarr_MovieFile_Id", movieFile.Id.ToString());
+ environmentVariables.Add("Radarr_MovieFile_RelativePath", movieFile.RelativePath);
+ environmentVariables.Add("Radarr_MovieFile_Path", Path.Combine(movie.Path, movieFile.RelativePath));
+ environmentVariables.Add("Radarr_MovieFile_Size", movieFile.Size.ToString());
+ environmentVariables.Add("Radarr_MovieFile_Quality", movieFile.Quality.Quality.Name);
+ environmentVariables.Add("Radarr_MovieFile_QualityVersion", movieFile.Quality.Revision.Version.ToString());
+ environmentVariables.Add("Radarr_MovieFile_ReleaseGroup", movieFile.ReleaseGroup ?? string.Empty);
+ environmentVariables.Add("Radarr_MovieFile_SceneName", movieFile.SceneName ?? string.Empty);
+
+ ExecuteScript(environmentVariables);
+ }
+
+ public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
+ {
+ var movie = deleteMessage.Movie;
+ var environmentVariables = new StringDictionary();
+
+ environmentVariables.Add("Radarr_EventType", "MovieDelete");
+ environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
+ environmentVariables.Add("Radarr_Movie_Title", movie.Title);
+ environmentVariables.Add("Radarr_Movie_Year", movie.Year.ToString());
+ environmentVariables.Add("Radarr_Movie_Path", movie.Path);
+ environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId ?? string.Empty);
+ environmentVariables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
+ environmentVariables.Add("Radarr_Movie_DeletedFiles", deleteMessage.DeletedFiles.ToString());
+
+ if (deleteMessage.DeletedFiles && movie.MovieFile != null)
+ {
+ environmentVariables.Add("Radarr_Movie_Folder_Size", movie.MovieFile.Size.ToString());
+ }
+
+ ExecuteScript(environmentVariables);
+ }
+
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var environmentVariables = new StringDictionary();
diff --git a/src/NzbDrone.Core/Notifications/Discord/Discord.cs b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
index 56780c274..458859e1d 100644
--- a/src/NzbDrone.Core/Notifications/Discord/Discord.cs
+++ b/src/NzbDrone.Core/Notifications/Discord/Discord.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
@@ -212,6 +213,43 @@ public override void OnDownload(DownloadMessage message)
_proxy.SendPayload(payload, Settings);
}
+ public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
+ {
+ var movie = deleteMessage.Movie;
+
+ var attachments = new List