New: On delete notifications

pull/1448/head
Robin Dadswell 3 years ago committed by Qstick
parent e4fdf71eee
commit be46d5ae8f

@ -59,6 +59,10 @@ class Notification extends Component {
onReleaseImport,
onUpgrade,
onRename,
onAuthorDelete,
onBookDelete,
onBookFileDelete,
onBookFileDeleteForUpgrade,
onHealthIssue,
onDownloadFailure,
onImportFailure,
@ -67,6 +71,10 @@ class Notification extends Component {
supportsOnReleaseImport,
supportsOnUpgrade,
supportsOnRename,
supportsOnAuthorDelete,
supportsOnBookDelete,
supportsOnBookFileDelete,
supportsOnBookFileDeleteForUpgrade,
supportsOnHealthIssue,
supportsOnDownloadFailure,
supportsOnImportFailure,
@ -84,70 +92,110 @@ class Notification extends Component {
</div>
{
supportsOnGrab && onGrab &&
supportsOnGrab && onGrab ?
<Label kind={kinds.SUCCESS}>
On Grab
</Label>
{translate('OnGrab')}
</Label> :
null
}
{
supportsOnReleaseImport && onReleaseImport &&
supportsOnReleaseImport && onReleaseImport ?
<Label kind={kinds.SUCCESS}>
On Release Import
</Label>
{translate('OnReleaseImport')}
</Label> :
null
}
{
supportsOnUpgrade && onReleaseImport && onUpgrade &&
supportsOnUpgrade && onReleaseImport && onUpgrade ?
<Label kind={kinds.SUCCESS}>
On Upgrade
</Label>
{translate('OnUpgrade')}
</Label> :
null
}
{
supportsOnRename && onRename &&
supportsOnRename && onRename ?
<Label kind={kinds.SUCCESS}>
On Rename
</Label>
{translate('OnRename')}
</Label> :
null
}
{
supportsOnBookRetag && onBookRetag &&
supportsOnBookRetag && onBookRetag ?
<Label kind={kinds.SUCCESS}>
On Book Tag Update
</Label>
{translate('OnBookTagUpdate')}
</Label> :
null
}
{
supportsOnHealthIssue && onHealthIssue &&
supportsOnAuthorDelete && onAuthorDelete ?
<Label kind={kinds.SUCCESS}>
On Health Issue
</Label>
{translate('OnAuthorDelete')}
</Label> :
null
}
{
supportsOnDownloadFailure && onDownloadFailure &&
supportsOnBookDelete && onBookDelete ?
<Label kind={kinds.SUCCESS}>
{translate('OnBookDelete')}
</Label> :
null
}
{
supportsOnBookFileDelete && onBookFileDelete ?
<Label kind={kinds.SUCCESS}>
{translate('OnBookFileDelete')}
</Label> :
null
}
{
supportsOnBookFileDeleteForUpgrade && onBookFileDelete && onBookFileDeleteForUpgrade ?
<Label kind={kinds.SUCCESS}>
{translate('OnBookFileDeleteForUpgrade')}
</Label> :
null
}
{
supportsOnHealthIssue && onHealthIssue ?
<Label kind={kinds.SUCCESS}>
{translate('OnHealthIssue')}
</Label> :
null
}
{
supportsOnDownloadFailure && onDownloadFailure ?
<Label kind={kinds.SUCCESS} >
On Download Failure
</Label>
{translate('OnDownloadFailure')}
</Label> :
null
}
{
supportsOnImportFailure && onImportFailure &&
supportsOnImportFailure && onImportFailure ?
<Label kind={kinds.SUCCESS} >
On Import Failure
</Label>
{translate('OnImportFailure')}
</Label> :
null
}
{
!onGrab && !onReleaseImport && !onRename && !onBookRetag &&
!onHealthIssue && !onDownloadFailure && !onImportFailure &&
<Label
kind={kinds.DISABLED}
outline={true}
>
Disabled
</Label>
!onGrab && !onReleaseImport && !onRename && !onBookRetag && !onHealthIssue && !onDownloadFailure && !onImportFailure ?
<Label
kind={kinds.DISABLED}
outline={true}
>
{translate('Disabled')}
</Label> :
null
}
<EditNotificationModalConnector
@ -178,6 +226,10 @@ Notification.propTypes = {
onReleaseImport: PropTypes.bool.isRequired,
onUpgrade: PropTypes.bool.isRequired,
onRename: PropTypes.bool.isRequired,
onAuthorDelete: PropTypes.bool.isRequired,
onBookDelete: PropTypes.bool.isRequired,
onBookFileDelete: PropTypes.bool.isRequired,
onBookFileDeleteForUpgrade: PropTypes.bool.isRequired,
onHealthIssue: PropTypes.bool.isRequired,
onDownloadFailure: PropTypes.bool.isRequired,
onImportFailure: PropTypes.bool.isRequired,
@ -186,6 +238,10 @@ Notification.propTypes = {
supportsOnReleaseImport: PropTypes.bool.isRequired,
supportsOnUpgrade: PropTypes.bool.isRequired,
supportsOnRename: PropTypes.bool.isRequired,
supportsOnAuthorDelete: PropTypes.bool.isRequired,
supportsOnBookDelete: PropTypes.bool.isRequired,
supportsOnBookFileDelete: PropTypes.bool.isRequired,
supportsOnBookFileDeleteForUpgrade: PropTypes.bool.isRequired,
supportsOnHealthIssue: PropTypes.bool.isRequired,
supportsOnDownloadFailure: PropTypes.bool.isRequired,
supportsOnImportFailure: PropTypes.bool.isRequired,

@ -19,6 +19,10 @@ function NotificationEventItems(props) {
onReleaseImport,
onUpgrade,
onRename,
onAuthorDelete,
onBookDelete,
onBookFileDelete,
onBookFileDeleteForUpgrade,
onHealthIssue,
onDownloadFailure,
onImportFailure,
@ -27,6 +31,9 @@ function NotificationEventItems(props) {
supportsOnReleaseImport,
supportsOnUpgrade,
supportsOnRename,
supportsOnAuthorDelete,
supportsOnBookDelete,
supportsOnBookFileDelete,
supportsOnHealthIssue,
includeHealthWarnings,
supportsOnDownloadFailure,
@ -114,6 +121,50 @@ function NotificationEventItems(props) {
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onAuthorDelete"
helpText={translate('OnAuthorDeleteHelpText')}
isDisabled={!supportsOnAuthorDelete.value}
{...onAuthorDelete}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onBookDelete"
helpText={translate('OnBookDeleteHelpText')}
isDisabled={!supportsOnBookDelete.value}
{...onBookDelete}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onBookFileDelete"
helpText={translate('OnBookFileDeleteHelpText')}
isDisabled={!supportsOnBookFileDelete.value}
{...onBookFileDelete}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onBookFileDeleteForUpgrade"
helpText={translate('OnBookFileDeleteForUpgradeHelpText')}
isDisabled={!supportsOnBookFileDelete.value}
{...onBookFileDeleteForUpgrade}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}

@ -106,6 +106,10 @@ export default {
selectedSchema.onReleaseImport = selectedSchema.supportsOnReleaseImport;
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
selectedSchema.onRename = selectedSchema.supportsOnRename;
selectedSchema.onAuthorDelete = selectedSchema.supportsOnAuthorDelete;
selectedSchema.onBookDelete = selectedSchema.supportsOnBookDelete;
selectedSchema.onBookFileDelete = selectedSchema.supportsOnBookFileDelete;
selectedSchema.onBookFileDeleteForUpgrade = selectedSchema.supportsOnBookFileDeleteForUpgrade;
selectedSchema.onHealthIssue = selectedSchema.supportsOnHealthIssue;
selectedSchema.onDownloadFailure = selectedSchema.supportsOnDownloadFailure;
selectedSchema.onImportFailure = selectedSchema.supportsOnImportFailure;

@ -62,6 +62,21 @@ namespace NzbDrone.Core.Test.NotificationTests
TestLogger.Info("OnRename was called");
}
public override void OnAuthorDelete(AuthorDeleteMessage message)
{
TestLogger.Info("OnAuthorDelete was called");
}
public override void OnBookDelete(BookDeleteMessage message)
{
TestLogger.Info("OnBookDelete was called");
}
public override void OnBookFileDelete(BookFileDeleteMessage message)
{
TestLogger.Info("OnBookFileDelete was called");
}
public override void OnHealthIssue(NzbDrone.Core.HealthCheck.HealthCheck author)
{
TestLogger.Info("OnHealthIssue was called");
@ -116,6 +131,10 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnUpgrade.Should().BeTrue();
notification.SupportsOnRename.Should().BeTrue();
notification.SupportsOnHealthIssue.Should().BeTrue();
notification.SupportsOnAuthorDelete.Should().BeTrue();
notification.SupportsOnBookDelete.Should().BeTrue();
notification.SupportsOnBookFileDelete.Should().BeTrue();
notification.SupportsOnBookFileDeleteForUpgrade.Should().BeTrue();
notification.SupportsOnDownloadFailure.Should().BeTrue();
notification.SupportsOnImportFailure.Should().BeTrue();
notification.SupportsOnBookRetag.Should().BeTrue();
@ -130,6 +149,10 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnReleaseImport.Should().BeFalse();
notification.SupportsOnUpgrade.Should().BeFalse();
notification.SupportsOnRename.Should().BeFalse();
notification.SupportsOnAuthorDelete.Should().BeFalse();
notification.SupportsOnBookDelete.Should().BeFalse();
notification.SupportsOnBookFileDelete.Should().BeFalse();
notification.SupportsOnBookFileDeleteForUpgrade.Should().BeFalse();
notification.SupportsOnHealthIssue.Should().BeFalse();
notification.SupportsOnDownloadFailure.Should().BeFalse();
notification.SupportsOnImportFailure.Should().BeFalse();

@ -1,3 +1,4 @@
using System.Collections.Generic;
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.Books.Events

@ -1,4 +1,4 @@
using NzbDrone.Common.Messaging;
using NzbDrone.Common.Messaging;
namespace NzbDrone.Core.Books.Events
{

@ -0,0 +1,17 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(21)]
public class add_on_delete_to_notifications : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnAuthorDelete").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnBookDelete").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnBookFileDelete").AsBoolean().WithDefaultValue(0);
Alter.Table("Notifications").AddColumn("OnBookFileDeleteForUpgrade").AsBoolean().WithDefaultValue(0);
}
}
}

@ -81,6 +81,10 @@ namespace NzbDrone.Core.Datastore
.Ignore(i => i.SupportsOnReleaseImport)
.Ignore(i => i.SupportsOnUpgrade)
.Ignore(i => i.SupportsOnRename)
.Ignore(i => i.SupportsOnAuthorDelete)
.Ignore(i => i.SupportsOnBookDelete)
.Ignore(i => i.SupportsOnBookFileDelete)
.Ignore(i => i.SupportsOnBookFileDeleteForUpgrade)
.Ignore(i => i.SupportsOnHealthIssue)
.Ignore(i => i.SupportsOnDownloadFailure)
.Ignore(i => i.SupportsOnImportFailure)

@ -70,11 +70,11 @@
"BookAvailableButMissing": "Book Available, but Missing",
"BookDownloaded": "Book Downloaded",
"BookEditor": "Book Editor",
"BookIndex": "Book Index",
"BookFileCountBookCountTotalTotalBookCountInterp": "{0} / {1} (Total: {2})",
"BookFileCounttotalBookCountBooksDownloadedInterp": "{0}/{1} books downloaded",
"BookFilesCountMessage": "No book files",
"BookHasNotAired": "Book has not aired",
"BookIndex": "Book Index",
"BookIsDownloading": "Book is downloading",
"BookIsDownloadingInterp": "Book is downloading - {0}% {1}",
"BookIsNotMonitored": "Book is not monitored",
@ -188,6 +188,7 @@
"DetailedProgressBar": "Detailed Progress Bar",
"DetailedProgressBarHelpText": "Show text on progess bar",
"Development": "Development",
"Disabled": "Disabled",
"DiscCount": "Disc Count",
"DiscNumber": "Disc Number",
"DiskSpace": "Disk Space",
@ -429,13 +430,29 @@
"NotificationTriggers": "Notification Triggers",
"NotMonitored": "Not Monitored",
"NoUpdatesAreAvailable": "No updates are available",
"OnAuthorDelete": "On Author Delete",
"OnAuthorDeleteHelpText": "On Author Delete",
"OnBookDelete": "On Book Delete",
"OnBookDeleteHelpText": "On Book Delete",
"OnBookFileDelete": "On Book File Delete",
"OnBookFileDeleteForUpgrade": "On Book File Delete For Upgrade",
"OnBookFileDeleteForUpgradeHelpText": "On Book File Delete For Upgrade",
"OnBookFileDeleteHelpText": "On Book File Delete",
"OnBookRetagHelpText": "On Book Retag",
"OnBookTagUpdate": "On Book Tag Update",
"OnDownloadFailure": "On Download Failure",
"OnDownloadFailureHelpText": "On Download Failure",
"OnGrab": "On Grab",
"OnGrabHelpText": "On Grab",
"OnHealthIssue": "On Health Issue",
"OnHealthIssueHelpText": "On Health Issue",
"OnImportFailure": "On Import Failure",
"OnImportFailureHelpText": "On Import Failure",
"OnReleaseImport": "On Release Import",
"OnReleaseImportHelpText": "On Release Import",
"OnRename": "On Rename",
"OnRenameHelpText": "On Rename",
"OnUpgrade": "On Upgrade",
"OnUpgradeHelpText": "On Upgrade",
"OpenBrowserOnStart": "Open browser on start",
"Options": "Options",
@ -588,9 +605,9 @@
"SetPermissionsLinuxHelpTextWarning": "If you're unsure what these settings do, do not alter them.",
"Settings": "Settings",
"ShortDateFormat": "Short Date Format",
"ShouldMonitorHelpText": "Monitor new authors and books added from this list",
"ShouldMonitorExisting": "Monitor existing books",
"ShouldMonitorExistingHelpText": "Automatically monitor books on this list which are already in Readarr",
"ShouldMonitorHelpText": "Monitor new authors and books added from this list",
"ShouldSearchHelpText": "Search indexers for newly added items. Use with caution for large lists.",
"ShowBanners": "Show Banners",
"ShowBannersHelpText": "Show banners instead of names",
@ -729,13 +746,13 @@
"UnmonitoredHelpText": "Include unmonitored books in the iCal feed",
"UnselectAll": "Unselect All",
"UpdateAll": "Update all",
"UpdateSelected": "Updated selected",
"UpdateAutomaticallyHelpText": "Automatically download and install updates. You will still be able to install from System: Updates",
"UpdateCovers": "Update Covers",
"UpdateCoversHelpText": "Set book covers in Calibre to match those in Readarr",
"UpdateMechanismHelpText": "Use Readarr's built-in updater or a script",
"Updates": "Updates",
"UpdateScriptPathHelpText": "Path to a custom script that takes an extracted update package and handle the remainder of the update process",
"UpdateSelected": "Updated selected",
"UpdatingIsDisabledInsideADockerContainerUpdateTheContainerImageInstead": "Updating is disabled inside a docker container. Update the container image instead.",
"UpgradeAllowedHelpText": "If disabled qualities will not be upgraded",
"Uptime": "Uptime",
@ -769,4 +786,4 @@
"WriteTagsSync": "All files; keep in sync with Goodreads",
"Year": "Year",
"YesCancel": "Yes, Cancel"
}
}

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

@ -33,6 +33,7 @@ namespace NzbDrone.Core.MediaFiles
private readonly IMediaFileService _mediaFileService;
private readonly IAuthorService _authorService;
private readonly IConfigService _configService;
private readonly IEventAggregator _eventAggregator;
private readonly IRootFolderService _rootFolderService;
private readonly ICalibreProxy _calibre;
private readonly Logger _logger;
@ -42,6 +43,7 @@ namespace NzbDrone.Core.MediaFiles
IMediaFileService mediaFileService,
IAuthorService authorService,
IConfigService configService,
IEventAggregator eventAggregator,
IRootFolderService rootFolderService,
ICalibreProxy calibre,
Logger logger)
@ -51,6 +53,7 @@ namespace NzbDrone.Core.MediaFiles
_mediaFileService = mediaFileService;
_authorService = authorService;
_configService = configService;
_eventAggregator = eventAggregator;
_rootFolderService = rootFolderService;
_calibre = calibre;
_logger = logger;
@ -97,6 +100,8 @@ namespace NzbDrone.Core.MediaFiles
// Delete the track file from the database to clean it up even if the file was already deleted
_mediaFileService.Delete(bookFile, DeleteMediaFileReason.Manual);
_eventAggregator.PublishEvent(new DeleteCompletedEvent());
}
private void DeleteFile(BookFile bookFile, string subfolder = "")
@ -178,6 +183,8 @@ namespace NzbDrone.Core.MediaFiles
{
_recycleBinProvider.DeleteFolder(message.Author.Path);
}
_eventAggregator.PublishEvent(new DeleteCompletedEvent());
}
}
}

@ -0,0 +1,27 @@
using NzbDrone.Core.Books;
namespace NzbDrone.Core.Notifications
{
public class AuthorDeleteMessage
{
public string Message { get; set; }
public Author Author { get; set; }
public bool DeletedFiles { get; set; }
public string DeletedFilesMessage { get; set; }
public override string ToString()
{
return Message;
}
public AuthorDeleteMessage(Author author, bool deleteFiles)
{
Author = author;
DeletedFiles = deleteFiles;
DeletedFilesMessage = DeletedFiles ?
"Author removed and all files were deleted" :
"Author removed, files were not deleted";
Message = author.Name + " - " + DeletedFilesMessage;
}
}
}

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

@ -0,0 +1,19 @@
using NzbDrone.Core.Books;
using NzbDrone.Core.MediaFiles;
namespace NzbDrone.Core.Notifications
{
public class BookFileDeleteMessage
{
public string Message { get; set; }
public Book Book { get; set; }
public BookFile BookFile { get; set; }
public DeleteMediaFileReason Reason { get; set; }
public override string ToString()
{
return Message;
}
}
}

@ -26,6 +26,21 @@ namespace NzbDrone.Core.Notifications.Boxcar
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, message.Message, Settings);

@ -105,6 +105,73 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var author = deleteMessage.Author;
var environmentVariables = new StringDictionary();
environmentVariables.Add("Readarr_EventType", "AuthorDelete");
environmentVariables.Add("Readarr_Author_Id", author.Id.ToString());
environmentVariables.Add("Readarr_Author_Name", author.Name);
environmentVariables.Add("Readarr_Author_Path", author.Path);
environmentVariables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
environmentVariables.Add("Readarr_Author_DeletedFiles", deleteMessage.DeletedFiles.ToString());
ExecuteScript(environmentVariables);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var author = deleteMessage.Book.Author.Value;
var book = deleteMessage.Book;
var environmentVariables = new StringDictionary();
environmentVariables.Add("Readarr_EventType", "BookDelete");
environmentVariables.Add("Readarr_Author_Id", author.Id.ToString());
environmentVariables.Add("Readarr_Author_Name", author.Name);
environmentVariables.Add("Readarr_Author_Path", author.Path);
environmentVariables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
environmentVariables.Add("Readarr_Book_Id", book.Id.ToString());
environmentVariables.Add("Readarr_Book_Title", book.Title);
environmentVariables.Add("Readarr_Book_GoodreadsId", book.ForeignBookId);
environmentVariables.Add("Readarr_Book_DeletedFiles", deleteMessage.DeletedFiles.ToString());
ExecuteScript(environmentVariables);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var author = deleteMessage.Book.Author.Value;
var book = deleteMessage.Book;
var bookFile = deleteMessage.BookFile;
var edition = bookFile.Edition.Value;
var environmentVariables = new StringDictionary();
environmentVariables.Add("Readarr_EventType", "BookFileDelete");
environmentVariables.Add("Readarr_Delete_Reason", deleteMessage.Reason.ToString());
environmentVariables.Add("Readarr_Author_Id", author.Id.ToString());
environmentVariables.Add("Readarr_Author_Name", author.Name);
environmentVariables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
environmentVariables.Add("Readarr_Book_Id", book.Id.ToString());
environmentVariables.Add("Readarr_Book_Title", book.Title);
environmentVariables.Add("Readarr_Book_GoodreadsId", book.ForeignBookId);
environmentVariables.Add("Readarr_BookFile_Id", bookFile.Id.ToString());
environmentVariables.Add("Readarr_BookFile_Path", bookFile.Path);
environmentVariables.Add("Readarr_BookFile_Quality", bookFile.Quality.Quality.Name);
environmentVariables.Add("Readarr_BookFile_QualityVersion", bookFile.Quality.Revision.Version.ToString());
environmentVariables.Add("Readarr_BookFile_ReleaseGroup", bookFile.ReleaseGroup ?? string.Empty);
environmentVariables.Add("Readarr_BookFile_SceneName", bookFile.SceneName ?? string.Empty);
environmentVariables.Add("Readarr_BookFile_Edition_Id", edition.Id.ToString());
environmentVariables.Add("Readarr_BookFile_Edition_Name", edition.Title);
environmentVariables.Add("Readarr_BookFile_Edition_GoodreadsId", edition.ForeignEditionId);
environmentVariables.Add("Readarr_BookFile_Edition_Isbn13", edition.Isbn13);
environmentVariables.Add("Readarr_BookFile_Edition_Asin", edition.Asin);
ExecuteScript(environmentVariables);
}
public override void OnBookRetag(BookRetagMessage message)
{
var author = message.Author;

@ -69,6 +69,54 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var attachments = new List<Embed>
{
new Embed
{
Title = deleteMessage.Author.Name,
Description = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Author Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var attachments = new List<Embed>
{
new Embed
{
Title = $"${deleteMessage.Book.Author.Value.Name} - ${deleteMessage.Book.Title}",
Description = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Book Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var attachments = new List<Embed>
{
new Embed
{
Title = $"${deleteMessage.Book.Author.Value.Name} - ${deleteMessage.Book.Title} - file deleted",
Description = deleteMessage.BookFile.Path
}
};
var payload = CreatePayload("Book File Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var attachments = new List<Embed>

@ -1,9 +1,11 @@
namespace NzbDrone.Core.Notifications.Discord
namespace NzbDrone.Core.Notifications.Discord
{
public enum DiscordColors
{
Danger = 15749200,
Success = 2605644,
Warning = 16753920
Warning = 16753920,
Standard = 16761392,
Upgrade = 4089856
}
}

@ -40,6 +40,27 @@ namespace NzbDrone.Core.Notifications.Email
SendEmail(Settings, BOOK_DOWNLOADED_TITLE_BRANDED, body, false, paths);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var body = deleteMessage.Message;
SendEmail(Settings, AUTHOR_DELETED_TITlE_BRANDED, body);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var body = deleteMessage.Message;
SendEmail(Settings, AUTHOR_DELETED_TITlE_BRANDED, body);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var body = deleteMessage.Message;
SendEmail(Settings, AUTHOR_DELETED_TITlE_BRANDED, body);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
SendEmail(Settings, HEALTH_ISSUE_TITLE_BRANDED, message.Message);

@ -40,6 +40,54 @@ namespace NzbDrone.Core.Notifications.Goodreads
AddToShelves(bookId, Settings.AddIds);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
foreach (var shelf in Settings.RemoveIds)
{
var listBooks = SearchShelf(shelf, deleteMessage.Author.Name);
var toRemove = listBooks.Where(x => deleteMessage.Author.Books.Value.Select(b => b.ForeignBookId).Contains(x.Book.WorkId.ToString()));
foreach (var listBook in toRemove)
{
RemoveBookFromShelves(listBook.Book.Id, shelf);
}
}
}
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
if (deleteMessage.DeletedFiles)
{
foreach (var shelf in Settings.RemoveIds)
{
var listBooks = SearchShelf(shelf, deleteMessage.Book.Author.Value.Name);
var toRemove = listBooks.Where(x => x.Book.WorkId.ToString() == deleteMessage.Book.ForeignBookId);
foreach (var listBook in toRemove)
{
RemoveBookFromShelves(listBook.Book.Id, shelf);
}
}
}
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
foreach (var shelf in Settings.RemoveIds)
{
var listBooks = SearchShelf(shelf, deleteMessage.Book.Author.Value.Name);
var toRemove = listBooks.Where(x => x.Book.WorkId.ToString() == deleteMessage.Book.ForeignBookId);
foreach (var listBook in toRemove)
{
RemoveBookFromShelves(listBook.Book.Id, shelf);
}
}
}
public override object RequestAction(string action, IDictionary<string, string> query)
{
if (action == "getBookshelves")

@ -29,6 +29,21 @@ namespace NzbDrone.Core.Notifications.Gotify
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -10,14 +10,22 @@ namespace NzbDrone.Core.Notifications
void OnGrab(GrabMessage grabMessage);
void OnReleaseImport(BookDownloadMessage message);
void OnRename(Author author);
void OnAuthorDelete(AuthorDeleteMessage deleteMessage);
void OnBookDelete(BookDeleteMessage deleteMessage);
void OnBookFileDelete(BookFileDeleteMessage deleteMessage);
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnDownloadFailure(DownloadFailedMessage message);
void OnImportFailure(BookDownloadMessage message);
void OnBookRetag(BookRetagMessage message);
void ProcessQueue();
bool SupportsOnGrab { get; }
bool SupportsOnReleaseImport { get; }
bool SupportsOnUpgrade { get; }
bool SupportsOnRename { get; }
bool SupportsOnAuthorDelete { get; }
bool SupportsOnBookDelete { get; }
bool SupportsOnBookFileDelete { get; }
bool SupportsOnBookFileDeleteForUpgrade { get; }
bool SupportsOnHealthIssue { get; }
bool SupportsOnDownloadFailure { get; }
bool SupportsOnImportFailure { get; }

@ -27,6 +27,21 @@ namespace NzbDrone.Core.Notifications.Join
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITlE_BRANDED, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE_BRANDED, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck message)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, message.Message, Settings);

@ -29,6 +29,21 @@ namespace NzbDrone.Core.Notifications.Mailgun
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, downloadMessage.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheckMessage)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheckMessage.Message, Settings);

@ -79,6 +79,73 @@ namespace NzbDrone.Core.Notifications.Notifiarr
_proxy.SendNotification(variables, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var author = deleteMessage.Author;
var variables = new StringDictionary();
variables.Add("Readarr_EventType", "AuthorDelete");
variables.Add("Readarr_Author_Id", author.Id.ToString());
variables.Add("Readarr_Author_Name", author.Name);
variables.Add("Readarr_Author_Path", author.Path);
variables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
variables.Add("Readarr_Author_DeletedFiles", deleteMessage.DeletedFiles.ToString());
_proxy.SendNotification(variables, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var author = deleteMessage.Book.Author.Value;
var book = deleteMessage.Book;
var variables = new StringDictionary();
variables.Add("Readarr_EventType", "BookDelete");
variables.Add("Readarr_Author_Id", author.Id.ToString());
variables.Add("Readarr_Author_Name", author.Name);
variables.Add("Readarr_Author_Path", author.Path);
variables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
variables.Add("Readarr_Book_Id", book.Id.ToString());
variables.Add("Readarr_Book_Title", book.Title);
variables.Add("Readarr_Book_GoodreadsId", book.ForeignBookId);
variables.Add("Readarr_Book_DeletedFiles", deleteMessage.DeletedFiles.ToString());
_proxy.SendNotification(variables, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var author = deleteMessage.Book.Author.Value;
var book = deleteMessage.Book;
var bookFile = deleteMessage.BookFile;
var edition = bookFile.Edition.Value;
var variables = new StringDictionary();
variables.Add("Readarr_EventType", "BookFileDelete");
variables.Add("Readarr_Delete_Reason", deleteMessage.Reason.ToString());
variables.Add("Readarr_Author_Id", author.Id.ToString());
variables.Add("Readarr_Author_Name", author.Name);
variables.Add("Readarr_Author_GoodreadsId", author.ForeignAuthorId);
variables.Add("Readarr_Book_Id", book.Id.ToString());
variables.Add("Readarr_Book_Title", book.Title);
variables.Add("Readarr_Book_GoodreadsId", book.ForeignBookId);
variables.Add("Readarr_BookFile_Id", bookFile.Id.ToString());
variables.Add("Readarr_BookFile_Path", bookFile.Path);
variables.Add("Readarr_BookFile_Quality", bookFile.Quality.Quality.Name);
variables.Add("Readarr_BookFile_QualityVersion", bookFile.Quality.Revision.Version.ToString());
variables.Add("Readarr_BookFile_ReleaseGroup", bookFile.ReleaseGroup ?? string.Empty);
variables.Add("Readarr_BookFile_SceneName", bookFile.SceneName ?? string.Empty);
variables.Add("Readarr_BookFile_Edition_Id", edition.Id.ToString());
variables.Add("Readarr_BookFile_Edition_Name", edition.Title);
variables.Add("Readarr_BookFile_Edition_GoodreadsId", edition.ForeignEditionId);
variables.Add("Readarr_BookFile_Edition_Isbn13", edition.Isbn13);
variables.Add("Readarr_BookFile_Edition_Asin", edition.Asin);
_proxy.SendNotification(variables, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var variables = new StringDictionary();

@ -11,6 +11,9 @@ namespace NzbDrone.Core.Notifications
{
protected const string BOOK_GRABBED_TITLE = "Book Grabbed";
protected const string BOOK_DOWNLOADED_TITLE = "Book Downloaded";
protected const string AUTHOR_DELETED_TITLE = "Author Deleted";
protected const string BOOK_DELETED_TITLE = "Book Deleted";
protected const string BOOK_FILE_DELETED_TITLE = "Book File Deleted";
protected const string HEALTH_ISSUE_TITLE = "Health Check Failure";
protected const string DOWNLOAD_FAILURE_TITLE = "Download Failed";
protected const string IMPORT_FAILURE_TITLE = "Import Failed";
@ -18,6 +21,9 @@ namespace NzbDrone.Core.Notifications
protected const string BOOK_GRABBED_TITLE_BRANDED = "Readarr - " + BOOK_GRABBED_TITLE;
protected const string BOOK_DOWNLOADED_TITLE_BRANDED = "Readarr - " + BOOK_DOWNLOADED_TITLE;
protected const string AUTHOR_DELETED_TITlE_BRANDED = "Readarr - " + AUTHOR_DELETED_TITLE;
protected const string BOOK_DELETED_TITLE_BRANDED = "Readarr - " + BOOK_DELETED_TITLE;
protected const string BOOK_FILE_DELETED_TITLE_BRANDED = "Readarr - " + BOOK_FILE_DELETED_TITLE;
protected const string HEALTH_ISSUE_TITLE_BRANDED = "Readarr - " + HEALTH_ISSUE_TITLE;
protected const string DOWNLOAD_FAILURE_TITLE_BRANDED = "Readarr - " + DOWNLOAD_FAILURE_TITLE;
protected const string IMPORT_FAILURE_TITLE_BRANDED = "Readarr - " + IMPORT_FAILURE_TITLE;
@ -48,6 +54,18 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
}
public virtual void OnBookDelete(BookDeleteMessage deleteMessage)
{
}
public virtual void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
}
public virtual void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
}
@ -64,8 +82,16 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void ProcessQueue()
{
}
public bool SupportsOnGrab => HasConcreteImplementation("OnGrab");
public bool SupportsOnRename => HasConcreteImplementation("OnRename");
public bool SupportsOnAuthorDelete => HasConcreteImplementation("OnAuthorDelete");
public bool SupportsOnBookDelete => HasConcreteImplementation("OnBookDelete");
public bool SupportsOnBookFileDelete => HasConcreteImplementation("OnBookFileDelete");
public bool SupportsOnBookFileDeleteForUpgrade => SupportsOnBookFileDelete;
public bool SupportsOnReleaseImport => HasConcreteImplementation("OnReleaseImport");
public bool SupportsOnUpgrade => SupportsOnReleaseImport;
public bool SupportsOnHealthIssue => HasConcreteImplementation("OnHealthIssue");

@ -8,6 +8,10 @@ namespace NzbDrone.Core.Notifications
public bool OnReleaseImport { get; set; }
public bool OnUpgrade { get; set; }
public bool OnRename { get; set; }
public bool OnAuthorDelete { get; set; }
public bool OnBookDelete { get; set; }
public bool OnBookFileDelete { get; set; }
public bool OnBookFileDeleteForUpgrade { get; set; }
public bool OnHealthIssue { get; set; }
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
@ -16,12 +20,16 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
public bool SupportsOnRename { get; set; }
public bool SupportsOnAuthorDelete { get; set; }
public bool SupportsOnBookDelete { get; set; }
public bool SupportsOnBookFileDelete { get; set; }
public bool SupportsOnBookFileDeleteForUpgrade { get; set; }
public bool SupportsOnHealthIssue { get; set; }
public bool IncludeHealthWarnings { get; set; }
public bool SupportsOnDownloadFailure { get; set; }
public bool SupportsOnImportFailure { get; set; }
public bool SupportsOnBookRetag { get; set; }
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnBookRetag;
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnAuthorDelete || OnBookDelete || OnBookFileDelete || OnBookFileDeleteForUpgrade || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnBookRetag;
}
}

@ -15,6 +15,10 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnUpgradeEnabled();
List<INotification> OnRenameEnabled();
List<INotification> OnHealthIssueEnabled();
List<INotification> OnAuthorDeleteEnabled();
List<INotification> OnBookDeleteEnabled();
List<INotification> OnBookFileDeleteEnabled();
List<INotification> OnBookFileDeleteForUpgradeEnabled();
List<INotification> OnDownloadFailureEnabled();
List<INotification> OnImportFailureEnabled();
List<INotification> OnBookRetagEnabled();
@ -47,6 +51,26 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
}
public List<INotification> OnAuthorDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnAuthorDelete).ToList();
}
public List<INotification> OnBookDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnBookDelete).ToList();
}
public List<INotification> OnBookFileDeleteEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnBookFileDelete).ToList();
}
public List<INotification> OnBookFileDeleteForUpgradeEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnBookFileDeleteForUpgrade).ToList();
}
public List<INotification> OnHealthIssueEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnHealthIssue).ToList();
@ -75,6 +99,10 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnReleaseImport = provider.SupportsOnReleaseImport;
definition.SupportsOnUpgrade = provider.SupportsOnUpgrade;
definition.SupportsOnRename = provider.SupportsOnRename;
definition.SupportsOnAuthorDelete = provider.SupportsOnAuthorDelete;
definition.SupportsOnBookDelete = provider.SupportsOnBookDelete;
definition.SupportsOnBookFileDelete = provider.SupportsOnBookFileDelete;
definition.SupportsOnBookFileDeleteForUpgrade = provider.SupportsOnBookFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = provider.SupportsOnHealthIssue;
definition.SupportsOnDownloadFailure = provider.SupportsOnDownloadFailure;
definition.SupportsOnImportFailure = provider.SupportsOnImportFailure;

@ -4,6 +4,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Books;
using NzbDrone.Core.Books.Events;
using NzbDrone.Core.Download;
using NzbDrone.Core.HealthCheck;
using NzbDrone.Core.MediaFiles;
@ -18,10 +19,14 @@ namespace NzbDrone.Core.Notifications
: IHandle<BookGrabbedEvent>,
IHandle<BookImportedEvent>,
IHandle<AuthorRenamedEvent>,
IHandle<AuthorDeletedEvent>,
IHandle<BookDeletedEvent>,
IHandle<BookFileDeletedEvent>,
IHandle<HealthCheckFailedEvent>,
IHandle<DownloadFailedEvent>,
IHandle<BookImportIncompleteEvent>,
IHandle<BookFileRetaggedEvent>
IHandle<BookFileRetaggedEvent>,
IHandleAsync<DeleteCompletedEvent>
{
private readonly INotificationFactory _notificationFactory;
private readonly Logger _logger;
@ -195,6 +200,76 @@ namespace NzbDrone.Core.Notifications
}
}
public void Handle(AuthorDeletedEvent message)
{
var deleteMessage = new AuthorDeleteMessage(message.Author, message.DeleteFiles);
foreach (var notification in _notificationFactory.OnAuthorDeleteEnabled())
{
try
{
if (ShouldHandleAuthor(notification.Definition, deleteMessage.Author))
{
notification.OnAuthorDelete(deleteMessage);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnAuthorDelete notification to: " + notification.Definition.Name);
}
}
}
public void Handle(BookDeletedEvent message)
{
var deleteMessage = new BookDeleteMessage(message.Book, message.DeleteFiles);
foreach (var notification in _notificationFactory.OnBookDeleteEnabled())
{
try
{
if (ShouldHandleAuthor(notification.Definition, deleteMessage.Book.Author))
{
notification.OnBookDelete(deleteMessage);
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnBookDelete notification to: " + notification.Definition.Name);
}
}
}
public void Handle(BookFileDeletedEvent message)
{
var deleteMessage = new BookFileDeleteMessage();
var book = new List<Book> { message.BookFile.Edition.Value.Book };
deleteMessage.Message = GetMessage(message.BookFile.Author, book, message.BookFile.Quality);
deleteMessage.BookFile = message.BookFile;
deleteMessage.Book = message.BookFile.Edition.Value.Book;
deleteMessage.Reason = message.Reason;
foreach (var notification in _notificationFactory.OnBookFileDeleteEnabled())
{
try
{
if (message.Reason != MediaFiles.DeleteMediaFileReason.Upgrade || ((NotificationDefinition)notification.Definition).OnBookFileDeleteForUpgrade)
{
if (ShouldHandleAuthor(notification.Definition, message.BookFile.Author))
{
notification.OnBookFileDelete(deleteMessage);
}
}
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnBookFileDelete notification to: " + notification.Definition.Name);
}
}
}
public void Handle(HealthCheckFailedEvent message)
{
foreach (var notification in _notificationFactory.OnHealthIssueEnabled())
@ -270,5 +345,25 @@ namespace NzbDrone.Core.Notifications
}
}
}
public void HandleAsync(DeleteCompletedEvent message)
{
ProcessQueue();
}
private void ProcessQueue()
{
foreach (var notification in _notificationFactory.GetAvailableProviders())
{
try
{
notification.ProcessQueue();
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to process notification queue for " + notification.Definition.Name);
}
}
}
}
}

@ -26,6 +26,21 @@ namespace NzbDrone.Core.Notifications.Prowl
_prowlProxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_prowlProxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -29,6 +29,21 @@ namespace NzbDrone.Core.Notifications.PushBullet
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message, Settings);

@ -26,6 +26,21 @@ namespace NzbDrone.Core.Notifications.Pushover
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -29,6 +29,21 @@ namespace NzbDrone.Core.Notifications.SendGrid
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -69,6 +69,54 @@ namespace NzbDrone.Core.Notifications.Slack
_proxy.SendPayload(payload, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = deleteMessage.Author.Name,
Text = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Author Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = $"${deleteMessage.Book.Author.Value.Name} - ${deleteMessage.Book.Title}",
Text = deleteMessage.DeletedFilesMessage
}
};
var payload = CreatePayload("Book Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = $"${deleteMessage.Book.Author.Value.Name} - ${deleteMessage.Book.Title} - file deleted",
Text = deleteMessage.BookFile.Path
}
};
var payload = CreatePayload("Book File Deleted", attachments);
_proxy.SendPayload(payload, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
var attachments = new List<Attachment>

@ -40,6 +40,38 @@ namespace NzbDrone.Core.Notifications.Subsonic
Update();
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
const string header = "Readarr - Author Deleted";
Notify(Settings, header, deleteMessage.Message);
if (deleteMessage.DeletedFiles)
{
Update();
}
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
const string header = "Readarr - Book Deleted";
Notify(Settings, header, deleteMessage.Message);
if (deleteMessage.DeletedFiles)
{
Update();
}
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
const string header = "Readarr - Book File Deleted";
Notify(Settings, header, deleteMessage.Message);
Update();
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
Notify(Settings, HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message);

@ -46,6 +46,33 @@ namespace NzbDrone.Core.Notifications.Synology
}
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
if (Settings.UpdateLibrary)
{
_indexerProxy.DeleteFolder(deleteMessage.Author.Path);
}
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
if (Settings.UpdateLibrary && deleteMessage.DeletedFiles)
{
foreach (var bookFile in deleteMessage.Book.BookFiles.Value)
{
_indexerProxy.DeleteFile(bookFile.Path);
}
}
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
if (Settings.UpdateLibrary)
{
_indexerProxy.DeleteFile(deleteMessage.BookFile.Path);
}
}
public override void OnBookRetag(BookRetagMessage message)
{
if (Settings.UpdateLibrary)

@ -26,6 +26,21 @@ namespace NzbDrone.Core.Notifications.Telegram
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_proxy.SendNotification(BOOK_FILE_DELETED_TITLE, deleteMessage.Message, Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);

@ -28,6 +28,21 @@ namespace NzbDrone.Core.Notifications.Twitter
_twitterService.SendNotification($"Imported: {message.Message}", Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Deleted: {deleteMessage.Message}", Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Deleted: {deleteMessage.Message}", Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
_twitterService.SendNotification($"Deleted: {deleteMessage.Message}", Settings);
}
public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck)
{
_twitterService.SendNotification($"Health Issue: {healthCheck.Message}", Settings);

@ -71,6 +71,43 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(payload, Settings);
}
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
{
var payload = new WebhookAuthorDeletePayload
{
EventType = WebhookEventType.Delete,
Author = new WebhookAuthor(deleteMessage.Author),
DeletedFiles = deleteMessage.DeletedFiles
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnBookDelete(BookDeleteMessage deleteMessage)
{
var payload = new WebhookBookDeletePayload
{
EventType = WebhookEventType.Delete,
Author = new WebhookAuthor(deleteMessage.Book.Author),
Book = new WebhookBook(deleteMessage.Book)
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnBookFileDelete(BookFileDeleteMessage deleteMessage)
{
var payload = new WebhookBookFileDeletePayload
{
EventType = WebhookEventType.Delete,
Author = new WebhookAuthor(deleteMessage.Book.Author),
Book = new WebhookBook(deleteMessage.Book),
BookFile = new WebhookBookFile(deleteMessage.BookFile)
};
_proxy.SendWebhook(payload, Settings);
}
public override void OnBookRetag(BookRetagMessage message)
{
var payload = new WebhookRetagPayload

@ -0,0 +1,8 @@
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookAuthorDeletePayload : WebhookPayload
{
public WebhookAuthor Author { get; set; }
public bool DeletedFiles { get; set; }
}
}

@ -0,0 +1,8 @@
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookBookDeletePayload : WebhookPayload
{
public WebhookAuthor Author { get; set; }
public WebhookBook Book { get; set; }
}
}

@ -0,0 +1,9 @@
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookBookFileDeletePayload : WebhookPayload
{
public WebhookAuthor Author { get; set; }
public WebhookBook Book { get; set; }
public WebhookBookFile BookFile { get; set; }
}
}

@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications.Webhook
Grab,
Download,
Rename,
Delete,
Health,
Retag
}

@ -9,6 +9,10 @@ namespace Readarr.Api.V1.Notifications
public bool OnReleaseImport { get; set; }
public bool OnUpgrade { get; set; }
public bool OnRename { get; set; }
public bool OnAuthorDelete { get; set; }
public bool OnBookDelete { get; set; }
public bool OnBookFileDelete { get; set; }
public bool OnBookFileDeleteForUpgrade { get; set; }
public bool OnHealthIssue { get; set; }
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
@ -17,6 +21,10 @@ namespace Readarr.Api.V1.Notifications
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
public bool SupportsOnRename { get; set; }
public bool SupportsOnAuthorDelete { get; set; }
public bool SupportsOnBookDelete { get; set; }
public bool SupportsOnBookFileDelete { get; set; }
public bool SupportsOnBookFileDeleteForUpgrade { get; set; }
public bool SupportsOnHealthIssue { get; set; }
public bool IncludeHealthWarnings { get; set; }
public bool SupportsOnDownloadFailure { get; set; }
@ -40,6 +48,10 @@ namespace Readarr.Api.V1.Notifications
resource.OnReleaseImport = definition.OnReleaseImport;
resource.OnUpgrade = definition.OnUpgrade;
resource.OnRename = definition.OnRename;
resource.OnAuthorDelete = definition.OnAuthorDelete;
resource.OnBookDelete = definition.OnBookDelete;
resource.OnBookFileDelete = definition.OnBookFileDelete;
resource.OnBookFileDeleteForUpgrade = definition.OnBookFileDeleteForUpgrade;
resource.OnHealthIssue = definition.OnHealthIssue;
resource.OnDownloadFailure = definition.OnDownloadFailure;
resource.OnImportFailure = definition.OnImportFailure;
@ -48,6 +60,10 @@ namespace Readarr.Api.V1.Notifications
resource.SupportsOnReleaseImport = definition.SupportsOnReleaseImport;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
resource.SupportsOnRename = definition.SupportsOnRename;
resource.SupportsOnAuthorDelete = definition.SupportsOnAuthorDelete;
resource.SupportsOnBookDelete = definition.SupportsOnBookDelete;
resource.SupportsOnBookFileDelete = definition.SupportsOnBookFileDelete;
resource.SupportsOnBookFileDeleteForUpgrade = definition.SupportsOnBookFileDeleteForUpgrade;
resource.SupportsOnHealthIssue = definition.SupportsOnHealthIssue;
resource.IncludeHealthWarnings = definition.IncludeHealthWarnings;
resource.SupportsOnDownloadFailure = definition.SupportsOnDownloadFailure;
@ -70,6 +86,10 @@ namespace Readarr.Api.V1.Notifications
definition.OnReleaseImport = resource.OnReleaseImport;
definition.OnUpgrade = resource.OnUpgrade;
definition.OnRename = resource.OnRename;
definition.OnAuthorDelete = resource.OnAuthorDelete;
definition.OnBookDelete = resource.OnBookDelete;
definition.OnBookFileDelete = resource.OnBookFileDelete;
definition.OnBookFileDeleteForUpgrade = resource.OnBookFileDeleteForUpgrade;
definition.OnHealthIssue = resource.OnHealthIssue;
definition.OnDownloadFailure = resource.OnDownloadFailure;
definition.OnImportFailure = resource.OnImportFailure;
@ -78,6 +98,10 @@ namespace Readarr.Api.V1.Notifications
definition.SupportsOnReleaseImport = resource.SupportsOnReleaseImport;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
definition.SupportsOnRename = resource.SupportsOnRename;
definition.SupportsOnAuthorDelete = resource.SupportsOnAuthorDelete;
definition.SupportsOnBookDelete = resource.SupportsOnBookDelete;
definition.SupportsOnBookFileDelete = resource.SupportsOnBookFileDelete;
definition.SupportsOnBookFileDeleteForUpgrade = resource.SupportsOnBookFileDeleteForUpgrade;
definition.SupportsOnHealthIssue = resource.SupportsOnHealthIssue;
definition.IncludeHealthWarnings = resource.IncludeHealthWarnings;
definition.SupportsOnDownloadFailure = resource.SupportsOnDownloadFailure;

Loading…
Cancel
Save