New: On Movie Delete and On Movie File Delete Notifications

pull/5992/head
Robin Dadswell 4 years ago committed by GitHub
parent 24de3fdee6
commit 5926ca5d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {
</div>
{
supportsOnGrab && onGrab &&
supportsOnGrab && onGrab ?
<Label kind={kinds.SUCCESS}>
{translate('OnGrab')}
</Label>
</Label> :
null
}
{
supportsOnDelete && onDelete &&
<Label kind={kinds.SUCCESS}>
{translate('OnDelete')}
</Label>
}
{
supportsOnDownload && onDownload &&
supportsOnDownload && onDownload ?
<Label kind={kinds.SUCCESS}>
{translate('OnImport')}
</Label>
</Label> :
null
}
{
supportsOnUpgrade && onDownload && onUpgrade &&
supportsOnUpgrade && onDownload && onUpgrade ?
<Label kind={kinds.SUCCESS}>
{translate('OnUpgrade')}
</Label>
</Label> :
null
}
{
supportsOnRename && onRename &&
supportsOnRename && onRename ?
<Label kind={kinds.SUCCESS}>
{translate('OnRename')}
</Label>
</Label> :
null
}
{
supportsOnHealthIssue && onHealthIssue &&
supportsOnHealthIssue && onHealthIssue ?
<Label kind={kinds.SUCCESS}>
{translate('OnHealthIssue')}
</Label>
</Label> :
null
}
{
supportsOnMovieDelete && onMovieDelete ?
<Label kind={kinds.SUCCESS}>
{translate('OnMovieDelete')}
</Label> :
null
}
{
supportsOnMovieFileDelete && onMovieFileDelete ?
<Label kind={kinds.SUCCESS}>
{translate('OnMovieFileDelete')}
</Label> :
null
}
{
supportsOnMovieFileDeleteForUpgrade && onMovieFileDelete && onMovieFileDeleteForUpgrade ?
<Label kind={kinds.SUCCESS}>
{translate('OnMovieFileDeleteForUpgrade')}
</Label> :
null
}
{
!onGrab && !onDownload && !onRename && !onHealthIssue && !onDelete &&
!onGrab && !onDownload && !onRename && !onHealthIssue && !onMovieDelete && !onMovieFileDelete ?
<Label
kind={kinds.DISABLED}
outline={true}
>
{translate('Disabled')}
</Label>
</Label> :
null
}
<EditNotificationModalConnector
@ -159,11 +186,15 @@ Notification.propTypes = {
onDownload: PropTypes.bool.isRequired,
onUpgrade: PropTypes.bool.isRequired,
onRename: PropTypes.bool.isRequired,
onDelete: PropTypes.bool.isRequired,
onMovieDelete: PropTypes.bool.isRequired,
onMovieFileDelete: PropTypes.bool.isRequired,
onMovieFileDeleteForUpgrade: PropTypes.bool.isRequired,
onHealthIssue: PropTypes.bool.isRequired,
supportsOnGrab: PropTypes.bool.isRequired,
supportsOnDownload: PropTypes.bool.isRequired,
supportsOnDelete: PropTypes.bool.isRequired,
supportsOnMovieDelete: PropTypes.bool.isRequired,
supportsOnMovieFileDelete: PropTypes.bool.isRequired,
supportsOnMovieFileDeleteForUpgrade: PropTypes.bool.isRequired,
supportsOnUpgrade: PropTypes.bool.isRequired,
supportsOnRename: PropTypes.bool.isRequired,
supportsOnHealthIssue: PropTypes.bool.isRequired,

@ -19,13 +19,17 @@ function NotificationEventItems(props) {
onDownload,
onUpgrade,
onRename,
onDelete,
onMovieDelete,
onMovieFileDelete,
onMovieFileDeleteForUpgrade,
onHealthIssue,
supportsOnGrab,
supportsOnDownload,
supportsOnUpgrade,
supportsOnRename,
supportsOnDelete,
supportsOnMovieDelete,
supportsOnMovieFileDelete,
supportsOnMovieFileDeleteForUpgrade,
supportsOnHealthIssue,
includeHealthWarnings
} = item;
@ -89,14 +93,39 @@ function NotificationEventItems(props) {
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onDelete"
helpText={translate('OnDeleteHelpText')}
isDisabled={!supportsOnDelete.value}
{...onDelete}
name="onMovieDelete"
helpText={translate('OnMovieDeleteHelpText')}
isDisabled={!supportsOnMovieDelete.value}
{...onMovieDelete}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onMovieFileDelete"
helpText={translate('OnMovieFileDeleteHelpText')}
isDisabled={!supportsOnMovieFileDelete.value}
{...onMovieFileDelete}
onChange={onInputChange}
/>
</div>
{
onMovieFileDelete.value &&
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onMovieFileDeleteForUpgrade"
helpText={translate('OnMovieFileDeleteForUpgradeHelpText')}
isDisabled={!supportsOnMovieFileDeleteForUpgrade.value}
{...onMovieFileDeleteForUpgrade}
onChange={onInputChange}
/>
</div>
}
<div>
<FormInputGroup
type={inputTypes.CHECK}

@ -106,6 +106,9 @@ export default {
selectedSchema.onDownload = selectedSchema.supportsOnDownload;
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
selectedSchema.onRename = selectedSchema.supportsOnRename;
selectedSchema.OnMovieDelete = selectedSchema.supportsOnMovieDelete;
selectedSchema.OnMovieFileDelete = selectedSchema.supportsOnMovieFileDelete;
selectedSchema.OnMovieFileDeleteForUpgrade = selectedSchema.supportsOnMovieFileDeleteForUpgrade;
return selectedSchema;
});

@ -1,4 +1,4 @@
using NzbDrone.Core.Notifications;
using NzbDrone.Core.Notifications;
namespace NzbDrone.Api.Notifications
{
@ -17,12 +17,16 @@ namespace NzbDrone.Api.Notifications
resource.OnDownload = definition.OnDownload;
resource.OnUpgrade = definition.OnUpgrade;
resource.OnRename = definition.OnRename;
resource.OnDelete = definition.OnDelete;
resource.OnMovieDelete = definition.OnMovieDelete;
resource.OnMovieFileDelete = definition.OnMovieFileDelete;
resource.OnMovieFileDeleteForUpgrade = definition.OnMovieFileDeleteForUpgrade;
resource.SupportsOnGrab = definition.SupportsOnGrab;
resource.SupportsOnDownload = definition.SupportsOnDownload;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
resource.SupportsOnRename = definition.SupportsOnRename;
resource.SupportsOnDelete = definition.SupportsOnDelete;
resource.SupportsOnMovieDelete = definition.SupportsOnMovieDelete;
resource.SupportsOnMovieFileDelete = definition.SupportsOnMovieFileDelete;
resource.SupportsOnMovieFileDeleteForUpgrade = definition.SupportsOnMovieFileDeleteForUpgrade;
resource.Tags = definition.Tags;
}
@ -34,12 +38,16 @@ namespace NzbDrone.Api.Notifications
definition.OnDownload = resource.OnDownload;
definition.OnUpgrade = resource.OnUpgrade;
definition.OnRename = resource.OnRename;
definition.OnDelete = resource.OnDelete;
definition.OnMovieDelete = resource.OnMovieDelete;
definition.OnMovieFileDelete = resource.OnMovieFileDelete;
definition.OnMovieFileDeleteForUpgrade = resource.OnMovieFileDeleteForUpgrade;
definition.SupportsOnGrab = resource.SupportsOnGrab;
definition.SupportsOnDownload = resource.SupportsOnDownload;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
definition.SupportsOnRename = resource.SupportsOnRename;
definition.SupportsOnDelete = resource.SupportsOnDelete;
definition.SupportsOnMovieDelete = resource.SupportsOnMovieDelete;
definition.SupportsOnMovieFileDelete = resource.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = resource.SupportsOnMovieFileDeleteForUpgrade;
definition.Tags = resource.Tags;
}

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace NzbDrone.Api.Notifications
{
@ -8,12 +8,16 @@ namespace NzbDrone.Api.Notifications
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<int> Tags { get; set; }
}
}

@ -1,4 +1,4 @@
using System;
using System;
using FluentAssertions;
using FluentValidation.Results;
using NUnit.Framework;
@ -62,9 +62,14 @@ namespace NzbDrone.Core.Test.NotificationTests
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 @@ namespace NzbDrone.Core.Test.NotificationTests
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 @@ namespace NzbDrone.Core.Test.NotificationTests
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();
}
}

@ -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);
}
}
}

@ -87,7 +87,9 @@ namespace NzbDrone.Core.Datastore
.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<MetadataDefinition>("Metadata").RegisterModel()

@ -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",

@ -0,0 +1,8 @@
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.MediaFiles.Events
{
public class DeleteCompletedEvent : IEvent
{
}
}

@ -28,6 +28,7 @@ namespace NzbDrone.Core.MediaFiles
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 @@ namespace NzbDrone.Core.MediaFiles
IMediaFileService mediaFileService,
IMovieService movieService,
IConfigService configService,
IEventAggregator eventAggregator,
Logger logger)
{
_diskProvider = diskProvider;
@ -42,6 +44,7 @@ namespace NzbDrone.Core.MediaFiles
_mediaFileService = mediaFileService;
_movieService = movieService;
_configService = configService;
_eventAggregator = eventAggregator;
_logger = logger;
}
@ -81,6 +84,8 @@ namespace NzbDrone.Core.MediaFiles
// 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 @@ namespace NzbDrone.Core.MediaFiles
_recycleBinProvider.DeleteFolder(movie.Path);
}
}
_eventAggregator.PublishEvent(new DeleteCompletedEvent());
}
}

@ -26,6 +26,16 @@ namespace NzbDrone.Core.Notifications.Boxcar
_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);

@ -117,6 +117,55 @@ namespace NzbDrone.Core.Notifications.CustomScript
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();

@ -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 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;
var attachments = new List<Embed>
{
new Embed
{
Title = movie.Title,
Description = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Movie Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;
var fullPath = Path.Combine(deleteMessage.Movie.Path, deleteMessage.MovieFile.RelativePath);
var attachments = new List<Embed>
{
new Embed
{
Title = movie.Title,
Description = deleteMessage.MovieFile.Path
}
};
var payload = CreatePayload("Movie File Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var attachments = new List<Embed>

@ -86,6 +86,54 @@ namespace NzbDrone.Core.Notifications.DiscordNotifier
_proxy.SendNotification(variables, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;
var movieFile = deleteMessage.MovieFile;
var variables = new StringDictionary();
variables.Add("Radarr_EventType", "MovieFileDelete");
variables.Add("Radarr_MovieFile_DeleteReason", deleteMessage.Reason.ToString());
variables.Add("Radarr_Movie_Id", movie.Id.ToString());
variables.Add("Radarr_Movie_Title", movie.Title);
variables.Add("Radarr_Movie_Year", movie.Year.ToString());
variables.Add("Radarr_Movie_Path", movie.Path);
variables.Add("Radarr_Movie_ImdbId", movie.ImdbId ?? string.Empty);
variables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
variables.Add("Radarr_MovieFile_Id", movieFile.Id.ToString());
variables.Add("Radarr_MovieFile_RelativePath", movieFile.RelativePath);
variables.Add("Radarr_MovieFile_Path", Path.Combine(movie.Path, movieFile.RelativePath));
variables.Add("Radarr_MovieFile_Size", movieFile.Size.ToString());
variables.Add("Radarr_MovieFile_Quality", movieFile.Quality.Quality.Name);
variables.Add("Radarr_MovieFile_QualityVersion", movieFile.Quality.Revision.Version.ToString());
variables.Add("Radarr_MovieFile_ReleaseGroup", movieFile.ReleaseGroup ?? string.Empty);
variables.Add("Radarr_MovieFile_SceneName", movieFile.SceneName ?? string.Empty);
_proxy.SendNotification(variables, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var movie = deleteMessage.Movie;
var variables = new StringDictionary();
variables.Add("Radarr_EventType", "MovieDelete");
variables.Add("Radarr_Movie_Id", movie.Id.ToString());
variables.Add("Radarr_Movie_Title", movie.Title);
variables.Add("Radarr_Movie_Year", movie.Year.ToString());
variables.Add("Radarr_Movie_Path", movie.Path);
variables.Add("Radarr_Movie_ImdbId", movie.ImdbId ?? string.Empty);
variables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
variables.Add("Radarr_Movie_DeletedFiles", deleteMessage.DeletedFiles.ToString());
if (deleteMessage.DeletedFiles && movie.MovieFile != null)
{
variables.Add("Radarr_Movie_Folder_Size", movie.MovieFile.Size.ToString());
}
_proxy.SendNotification(variables, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var variables = new StringDictionary();

@ -31,6 +31,20 @@ namespace NzbDrone.Core.Notifications.Email
_emailService.SendEmail(Settings, MOVIE_DOWNLOADED_TITLE_BRANDED, body);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var body = $"{deleteMessage.Message} deleted.";
_emailService.SendEmail(Settings, MOVIE_FILE_DELETED_TITLE_BRANDED, body);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var body = $"{deleteMessage.Message}";
_emailService.SendEmail(Settings, MOVIE_DELETED_TITLE_BRANDED, body);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_emailService.SendEmail(Settings, HEALTH_ISSUE_TITLE_BRANDED, message.Message);

@ -29,6 +29,16 @@ namespace NzbDrone.Core.Notifications.Gotify
_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 healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -10,14 +10,17 @@ namespace NzbDrone.Core.Notifications
void OnGrab(GrabMessage grabMessage);
void OnDownload(DownloadMessage message);
void OnMovieRename(Movie movie);
void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage);
void OnMovieDelete(MovieDeleteMessage deleteMessage);
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnDelete(DeleteMessage deleteMessage);
void ProcessQueue();
bool SupportsOnGrab { get; }
bool SupportsOnDownload { get; }
bool SupportsOnUpgrade { get; }
bool SupportsOnRename { get; }
bool SupportsOnMovieDelete { get; }
bool SupportsOnMovieFileDelete { get; }
bool SupportsOnMovieFileDeleteForUpgrade { get; }
bool SupportsOnHealthIssue { get; }
bool SupportsOnDelete { get; }
}
}

@ -27,6 +27,16 @@ namespace NzbDrone.Core.Notifications.Join
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_FILE_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
_proxy.SendNotification(MOVIE_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, message.Message, Settings);

@ -0,0 +1,28 @@
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications
{
public class MovieDeleteMessage
{
public string Message { get; set; }
public Movie Movie { get; set; }
public bool DeletedFiles { get; set; }
public string DeletedFilesMessage { get; set; }
public override string ToString()
{
return Message;
}
public MovieDeleteMessage(Movie movie, bool deleteFiles)
{
Movie = movie;
DeletedFiles = deleteFiles;
DeletedFilesMessage = DeletedFiles ?
"Movie removed and all files were deleted" :
"Movie removed, files were not deleted";
Message = movie.Title + " - " + DeletedFilesMessage;
}
}
}

@ -0,0 +1,19 @@
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Movies;
namespace NzbDrone.Core.Notifications
{
public class MovieFileDeleteMessage
{
public string Message { get; set; }
public Movie Movie { get; set; }
public MovieFile MovieFile { get; set; }
public DeleteMediaFileReason Reason { get; set; }
public override string ToString()
{
return Message;
}
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Core.Movies;
using NzbDrone.Core.ThingiProvider;
@ -11,10 +12,14 @@ namespace NzbDrone.Core.Notifications
{
protected const string MOVIE_GRABBED_TITLE = "Movie Grabbed";
protected const string MOVIE_DOWNLOADED_TITLE = "Movie Downloaded";
protected const string MOVIE_DELETED_TITLE = "Movie Deleted";
protected const string MOVIE_FILE_DELETED_TITLE = "Movie File Deleted";
protected const string HEALTH_ISSUE_TITLE = "Health Check Failure";
protected const string MOVIE_GRABBED_TITLE_BRANDED = "Radarr - " + MOVIE_GRABBED_TITLE;
protected const string MOVIE_DOWNLOADED_TITLE_BRANDED = "Radarr - " + MOVIE_DOWNLOADED_TITLE;
protected const string MOVIE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_DELETED_TITLE;
protected const string MOVIE_FILE_DELETED_TITLE_BRANDED = "Radarr - " + MOVIE_FILE_DELETED_TITLE;
protected const string HEALTH_ISSUE_TITLE_BRANDED = "Radarr - " + HEALTH_ISSUE_TITLE;
public abstract string Name { get; }
@ -42,11 +47,15 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
public virtual void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
}
public virtual void OnDelete(DeleteMessage deleteMessage)
public virtual void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
}
public virtual void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
}
@ -58,8 +67,10 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnRename => HasConcreteImplementation("OnMovieRename");
public bool SupportsOnDownload => HasConcreteImplementation("OnDownload");
public bool SupportsOnUpgrade => SupportsOnDownload;
public bool SupportsOnMovieDelete => HasConcreteImplementation("OnMovieDelete");
public bool SupportsOnMovieFileDelete => HasConcreteImplementation("OnMovieFileDelete");
public bool SupportsOnMovieFileDeleteForUpgrade => SupportsOnMovieFileDelete;
public bool SupportsOnHealthIssue => HasConcreteImplementation("OnHealthIssue");
public bool SupportsOnDelete => HasConcreteImplementation("OnDelete");
protected TSettings Settings => (TSettings)Definition.Settings;

@ -8,16 +8,20 @@ namespace NzbDrone.Core.Notifications
public bool OnDownload { get; set; }
public bool OnUpgrade { get; set; }
public bool OnRename { get; set; }
public bool OnMovieDelete { get; set; }
public bool OnMovieFileDelete { get; set; }
public bool OnMovieFileDeleteForUpgrade { get; set; }
public bool OnHealthIssue { get; set; }
public bool OnDelete { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnDownload { get; set; }
public bool SupportsOnUpgrade { get; set; }
public bool SupportsOnRename { get; set; }
public bool SupportsOnMovieDelete { get; set; }
public bool SupportsOnMovieFileDelete { get; set; }
public bool SupportsOnMovieFileDeleteForUpgrade { get; set; }
public bool SupportsOnHealthIssue { get; set; }
public bool SupportsOnDelete { get; set; }
public bool IncludeHealthWarnings { get; set; }
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnHealthIssue || OnDelete;
public override bool Enable => OnGrab || OnDownload || (OnDownload && OnUpgrade) || OnMovieDelete || OnMovieFileDelete || OnMovieFileDeleteForUpgrade || OnHealthIssue;
}
}

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Common.Composition;
@ -13,8 +13,9 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnDownloadEnabled();
List<INotification> OnUpgradeEnabled();
List<INotification> OnRenameEnabled();
List<INotification> OnMovieDeleteEnabled();
List<INotification> OnMovieFileDeleteEnabled();
List<INotification> OnHealthIssueEnabled();
List<INotification> OnDeleteEnabled();
}
public class NotificationFactory : ProviderFactory<INotification, NotificationDefinition>, INotificationFactory
@ -44,14 +45,24 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
}
public List<INotification> OnHealthIssueEnabled()
public List<INotification> OnMovieDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthIssue).ToList();
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnMovieDelete).ToList();
}
public List<INotification> OnMovieFileDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnMovieFileDelete).ToList();
}
public List<INotification> OnDeleteEnabled()
public List<INotification> OnMovieFileDeleteForUpgradeEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnDelete).ToList();
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnMovieFileDeleteForUpgrade).ToList();
}
public List<INotification> OnHealthIssueEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthIssue).ToList();
}
public override void SetProviderCharacteristics(INotification provider, NotificationDefinition definition)
@ -62,8 +73,10 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnDownload = provider.SupportsOnDownload;
definition.SupportsOnUpgrade = provider.SupportsOnUpgrade;
definition.SupportsOnRename = provider.SupportsOnRename;
definition.SupportsOnMovieDelete = provider.SupportsOnMovieDelete;
definition.SupportsOnMovieFileDelete = provider.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = provider.SupportsOnMovieFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = provider.SupportsOnHealthIssue;
definition.SupportsOnDelete = provider.SupportsOnDelete;
}
}
}

@ -7,6 +7,7 @@ using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.ThingiProvider;
@ -16,8 +17,10 @@ namespace NzbDrone.Core.Notifications
: IHandle<MovieRenamedEvent>,
IHandle<MovieGrabbedEvent>,
IHandle<MovieDownloadedEvent>,
IHandle<HealthCheckFailedEvent>,
IHandle<MoviesDeletedEvent>,
IHandle<MovieFileDeletedEvent>,
IHandle<HealthCheckFailedEvent>,
IHandleAsync<DeleteCompletedEvent>,
IHandleAsync<DownloadsProcessedEvent>,
IHandleAsync<RenameCompletedEvent>,
IHandleAsync<HealthCheckCompleteEvent>
@ -159,47 +162,78 @@ namespace NzbDrone.Core.Notifications
}
}
public void Handle(HealthCheckFailedEvent message)
public void Handle(MovieFileDeletedEvent message)
{
foreach (var notification in _notificationFactory.OnHealthIssueEnabled())
var deleteMessage = new MovieFileDeleteMessage();
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.OnMovieFileDeleteEnabled())
{
try
{
if (ShouldHandleHealthFailure(message.HealthCheck, ((NotificationDefinition)notification.Definition).IncludeHealthWarnings))
if (message.Reason != MediaFiles.DeleteMediaFileReason.Upgrade || ((NotificationDefinition)notification.Definition).OnMovieFileDeleteForUpgrade)
{
notification.OnHealthIssue(message.HealthCheck);
if (ShouldHandleMovie(notification.Definition, message.MovieFile.Movie))
{
notification.OnMovieFileDelete(deleteMessage);
}
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnHealthIssue notification to: " + notification.Definition.Name);
_logger.Warn(ex, "Unable to send OnMovieFileDelete notification to: " + notification.Definition.Name);
}
}
}
public void Handle(MovieFileDeletedEvent message)
public void Handle(MoviesDeletedEvent 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 (Movie movie in message.Movies)
{
var deleteMessage = new MovieDeleteMessage(movie, message.DeleteFiles);
foreach (var notification in _notificationFactory.OnDeleteEnabled())
foreach (var notification in _notificationFactory.OnMovieDeleteEnabled())
{
try
{
if (ShouldHandleMovie(notification.Definition, message.MovieFile.Movie))
if (ShouldHandleMovie(notification.Definition, deleteMessage.Movie))
{
notification.OnDelete(deleteMessage);
notification.OnMovieDelete(deleteMessage);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnDelete notification to: " + notification.Definition.Name);
_logger.Warn(ex, "Unable to send OnMovieDelete notification to: " + notification.Definition.Name);
}
}
}
}
public void Handle(HealthCheckFailedEvent message)
{
foreach (var notification in _notificationFactory.OnHealthIssueEnabled())
{
try
{
if (ShouldHandleHealthFailure(message.HealthCheck, ((NotificationDefinition)notification.Definition).IncludeHealthWarnings))
{
notification.OnHealthIssue(message.HealthCheck);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnHealthIssue notification to: " + notification.Definition.Name);
}
}
}
public void HandleAsync(DeleteCompletedEvent message)
{
ProcessQueue();
}
public void HandleAsync(DownloadsProcessedEvent message)
{

@ -48,6 +48,19 @@ namespace NzbDrone.Core.Notifications.Plex.Server
UpdateIfEnabled(movie);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
UpdateIfEnabled(deleteMessage.Movie);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
UpdateIfEnabled(deleteMessage.Movie);
}
}
private void UpdateIfEnabled(Movie movie)
{
if (Settings.UpdateLibrary)

@ -26,9 +26,19 @@ namespace NzbDrone.Core.Notifications.Prowl
_prowlProxy.SendNotification(MOVIE_DOWNLOADED_TITLE, message.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
_prowlProxy.SendNotification(MOVIE_FILE_DELETED_TITLE, deleteMessage.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(MOVIE_DELETED_TITLE, deleteMessage.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings.ApiKey, (ProwlPriority)Settings.Priority);
}
public override ValidationResult Test()

@ -29,6 +29,16 @@ namespace NzbDrone.Core.Notifications.PushBullet
_proxy.SendNotification(MOVIE_DOWNLOADED_TITLE_BRANDED, 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 healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message, Settings);

@ -26,6 +26,16 @@ namespace NzbDrone.Core.Notifications.Pushover
_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 healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -29,6 +29,16 @@ namespace NzbDrone.Core.Notifications.SendGrid
_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 healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
@ -69,6 +71,38 @@ namespace NzbDrone.Core.Notifications.Slack
_proxy.SendPayload(payload, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = deleteMessage.Movie.Title,
Text = Path.Combine(deleteMessage.Movie.Path, deleteMessage.MovieFile.RelativePath)
}
};
var payload = CreatePayload("Movie File Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = deleteMessage.Movie.Title,
Text = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Movie Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var attachments = new List<Attachment>

@ -46,6 +46,26 @@ namespace NzbDrone.Core.Notifications.Synology
}
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
if (Settings.UpdateLibrary)
{
var fullPath = Path.Combine(deleteMessage.Movie.Path, deleteMessage.MovieFile.RelativePath);
_indexerProxy.DeleteFile(fullPath);
}
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
if (Settings.UpdateLibrary)
{
_indexerProxy.DeleteFolder(deleteMessage.Movie.Path);
}
}
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

@ -26,6 +26,16 @@ namespace NzbDrone.Core.Notifications.Telegram
_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 healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -29,11 +29,16 @@ namespace NzbDrone.Core.Notifications.Trakt
_traktService.AddMovieToCollection(Settings, message.Movie, message.MovieFile);
}
public override void OnDelete(DeleteMessage message)
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
if (message.Reason != MediaFiles.DeleteMediaFileReason.Upgrade)
_traktService.RemoveMovieFromCollection(Settings, deleteMessage.Movie);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
_traktService.RemoveMovieFromCollection(Settings, message.Movie, message.MovieFile);
_traktService.RemoveMovieFromCollection(Settings, deleteMessage.Movie);
}
}

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Notifications.Trakt
HttpRequest GetOAuthRequest(string callbackUrl);
TraktAuthRefreshResource RefreshAuthToken(string refreshToken);
void AddMovieToCollection(TraktSettings settings, Movie movie, MovieFile movieFile);
void RemoveMovieFromCollection(TraktSettings settings, Movie movie, MovieFile movieFile);
void RemoveMovieFromCollection(TraktSettings settings, Movie movie);
string GetUserName(string accessToken);
ValidationFailure Test(TraktSettings settings);
}
@ -76,7 +76,7 @@ namespace NzbDrone.Core.Notifications.Trakt
}
}
public void RemoveMovieFromCollection(TraktSettings settings, Movie movie, MovieFile movieFile)
public void RemoveMovieFromCollection(TraktSettings settings, Movie movie)
{
var payload = new TraktCollectMoviesResource
{

@ -28,6 +28,16 @@ namespace NzbDrone.Core.Notifications.Twitter
_twitterService.SendNotification($"[Radarr] Imported: {message.Message}", Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Movie File Deleted: {deleteMessage.Message}", Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Movie Deleted: {deleteMessage.Message}", Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_twitterService.SendNotification($"Health Issue: {healthCheck.Message}", Settings);

@ -75,6 +75,31 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(payload, Settings);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
var payload = new WebhookMovieFileDeletePayload
{
EventType = WebhookEventType.MovieFileDelete,
Movie = new WebhookMovie(deleteMessage.Movie),
MovieFile = new WebhookMovieFile(deleteMessage.MovieFile),
DeleteReason = deleteMessage.Reason
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
var payload = new WebhookMovieDeletePayload
{
EventType = WebhookEventType.MovieDelete,
Movie = new WebhookMovie(deleteMessage.Movie),
DeletedFiles = deleteMessage.DeletedFiles
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var payload = new WebhookHealthPayload

@ -12,6 +12,8 @@ namespace NzbDrone.Core.Notifications.Webhook
Grab,
Download,
Rename,
MovieDelete,
MovieFileDelete,
Health
}
}

@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookMovieDeletePayload : WebhookPayload
{
public WebhookMovie Movie { get; set; }
public bool DeletedFiles { get; set; }
}
}

@ -0,0 +1,12 @@
using System.Collections.Generic;
using NzbDrone.Core.MediaFiles;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookMovieFileDeletePayload : WebhookPayload
{
public WebhookMovie Movie { get; set; }
public WebhookMovieFile MovieFile { get; set; }
public DeleteMediaFileReason DeleteReason { get; set; }
}
}

@ -41,6 +41,25 @@ namespace NzbDrone.Core.Notifications.Xbmc
UpdateAndCleanMovie(movie);
}
public override void OnMovieFileDelete(MovieFileDeleteMessage deleteMessage)
{
const string header = "Radarr - Deleted";
Notify(Settings, header, deleteMessage.Message);
UpdateAndCleanMovie(deleteMessage.Movie, true);
}
public override void OnMovieDelete(MovieDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
const string header = "Radarr - Deleted";
Notify(Settings, header, deleteMessage.Message);
UpdateAndCleanMovie(deleteMessage.Movie, true);
}
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
Notify(Settings, HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message);

@ -9,13 +9,17 @@ namespace Radarr.Api.V3.Notifications
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 OnHealthIssue { 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 bool SupportsOnHealthIssue { get; set; }
public bool IncludeHealthWarnings { get; set; }
public string TestCommand { get; set; }
@ -36,13 +40,17 @@ namespace Radarr.Api.V3.Notifications
resource.OnDownload = definition.OnDownload;
resource.OnUpgrade = definition.OnUpgrade;
resource.OnRename = definition.OnRename;
resource.OnDelete = definition.OnDelete;
resource.OnMovieDelete = definition.OnMovieDelete;
resource.OnMovieFileDelete = definition.OnMovieFileDelete;
resource.OnMovieFileDeleteForUpgrade = definition.OnMovieFileDeleteForUpgrade;
resource.OnHealthIssue = definition.OnHealthIssue;
resource.SupportsOnGrab = definition.SupportsOnGrab;
resource.SupportsOnDownload = definition.SupportsOnDownload;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
resource.SupportsOnRename = definition.SupportsOnRename;
resource.SupportsOnDelete = definition.SupportsOnDelete;
resource.SupportsOnMovieDelete = definition.SupportsOnMovieDelete;
resource.SupportsOnMovieFileDelete = definition.SupportsOnMovieFileDelete;
resource.SupportsOnMovieFileDeleteForUpgrade = definition.SupportsOnMovieFileDeleteForUpgrade;
resource.SupportsOnHealthIssue = definition.SupportsOnHealthIssue;
resource.IncludeHealthWarnings = definition.IncludeHealthWarnings;
@ -62,13 +70,17 @@ namespace Radarr.Api.V3.Notifications
definition.OnDownload = resource.OnDownload;
definition.OnUpgrade = resource.OnUpgrade;
definition.OnRename = resource.OnRename;
definition.OnDelete = resource.OnDelete;
definition.OnMovieDelete = resource.OnMovieDelete;
definition.OnMovieFileDelete = resource.OnMovieFileDelete;
definition.OnMovieFileDeleteForUpgrade = resource.OnMovieFileDeleteForUpgrade;
definition.OnHealthIssue = resource.OnHealthIssue;
definition.SupportsOnGrab = resource.SupportsOnGrab;
definition.SupportsOnDownload = resource.SupportsOnDownload;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
definition.SupportsOnRename = resource.SupportsOnRename;
definition.SupportsOnDelete = resource.SupportsOnDelete;
definition.SupportsOnMovieDelete = resource.SupportsOnMovieDelete;
definition.SupportsOnMovieFileDelete = resource.SupportsOnMovieFileDelete;
definition.SupportsOnMovieFileDeleteForUpgrade = resource.SupportsOnMovieFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = resource.SupportsOnHealthIssue;
definition.IncludeHealthWarnings = resource.IncludeHealthWarnings;

Loading…
Cancel
Save