mirror of
https://github.com/Readarr/Readarr.git
synced 2026-03-05 13:20:32 -05:00
@@ -60,6 +60,7 @@ class Notification extends Component {
|
||||
onReleaseImport,
|
||||
onUpgrade,
|
||||
onRename,
|
||||
onAuthorAdded,
|
||||
onAuthorDelete,
|
||||
onBookDelete,
|
||||
onBookFileDelete,
|
||||
@@ -73,6 +74,7 @@ class Notification extends Component {
|
||||
supportsOnReleaseImport,
|
||||
supportsOnUpgrade,
|
||||
supportsOnRename,
|
||||
supportsOnAuthorAdded,
|
||||
supportsOnAuthorDelete,
|
||||
supportsOnBookDelete,
|
||||
supportsOnBookFileDelete,
|
||||
@@ -136,6 +138,14 @@ class Notification extends Component {
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
supportsOnAuthorAdded && onAuthorAdded ?
|
||||
<Label kind={kinds.SUCCESS}>
|
||||
{translate('OnAuthorAdded')}
|
||||
</Label> :
|
||||
null
|
||||
}
|
||||
|
||||
{
|
||||
supportsOnAuthorDelete && onAuthorDelete ?
|
||||
<Label kind={kinds.SUCCESS}>
|
||||
@@ -244,6 +254,7 @@ Notification.propTypes = {
|
||||
onReleaseImport: PropTypes.bool.isRequired,
|
||||
onUpgrade: PropTypes.bool.isRequired,
|
||||
onRename: PropTypes.bool.isRequired,
|
||||
onAuthorAdded: PropTypes.bool.isRequired,
|
||||
onAuthorDelete: PropTypes.bool.isRequired,
|
||||
onBookDelete: PropTypes.bool.isRequired,
|
||||
onBookFileDelete: PropTypes.bool.isRequired,
|
||||
@@ -257,6 +268,7 @@ Notification.propTypes = {
|
||||
supportsOnReleaseImport: PropTypes.bool.isRequired,
|
||||
supportsOnUpgrade: PropTypes.bool.isRequired,
|
||||
supportsOnRename: PropTypes.bool.isRequired,
|
||||
supportsOnAuthorAdded: PropTypes.bool.isRequired,
|
||||
supportsOnAuthorDelete: PropTypes.bool.isRequired,
|
||||
supportsOnBookDelete: PropTypes.bool.isRequired,
|
||||
supportsOnBookFileDelete: PropTypes.bool.isRequired,
|
||||
|
||||
@@ -19,6 +19,7 @@ function NotificationEventItems(props) {
|
||||
onReleaseImport,
|
||||
onUpgrade,
|
||||
onRename,
|
||||
onAuthorAdded,
|
||||
onAuthorDelete,
|
||||
onBookDelete,
|
||||
onBookFileDelete,
|
||||
@@ -32,6 +33,7 @@ function NotificationEventItems(props) {
|
||||
supportsOnReleaseImport,
|
||||
supportsOnUpgrade,
|
||||
supportsOnRename,
|
||||
supportsOnAuthorAdded,
|
||||
supportsOnAuthorDelete,
|
||||
supportsOnBookDelete,
|
||||
supportsOnBookFileDelete,
|
||||
@@ -123,6 +125,17 @@ function NotificationEventItems(props) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="onAuthorAdded"
|
||||
helpText={translate('OnAuthorAddedHelpText')}
|
||||
isDisabled={!supportsOnAuthorAdded.value}
|
||||
{...onAuthorAdded}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
|
||||
@@ -106,6 +106,7 @@ export default {
|
||||
selectedSchema.onReleaseImport = selectedSchema.supportsOnReleaseImport;
|
||||
selectedSchema.onUpgrade = selectedSchema.supportsOnUpgrade;
|
||||
selectedSchema.onRename = selectedSchema.supportsOnRename;
|
||||
selectedSchema.onAuthorAdded = selectedSchema.supportsOnAuthorAdded;
|
||||
selectedSchema.onAuthorDelete = selectedSchema.supportsOnAuthorDelete;
|
||||
selectedSchema.onBookDelete = selectedSchema.supportsOnBookDelete;
|
||||
selectedSchema.onBookFileDelete = selectedSchema.supportsOnBookFileDelete;
|
||||
|
||||
@@ -64,6 +64,11 @@ namespace NzbDrone.Core.Test.NotificationTests
|
||||
TestLogger.Info("OnRename was called");
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
TestLogger.Info("OnAuthorAdded was called");
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage message)
|
||||
{
|
||||
TestLogger.Info("OnAuthorDelete was called");
|
||||
@@ -138,6 +143,7 @@ namespace NzbDrone.Core.Test.NotificationTests
|
||||
notification.SupportsOnUpgrade.Should().BeTrue();
|
||||
notification.SupportsOnRename.Should().BeTrue();
|
||||
notification.SupportsOnHealthIssue.Should().BeTrue();
|
||||
notification.SupportsOnAuthorAdded.Should().BeTrue();
|
||||
notification.SupportsOnAuthorDelete.Should().BeTrue();
|
||||
notification.SupportsOnBookDelete.Should().BeTrue();
|
||||
notification.SupportsOnBookFileDelete.Should().BeTrue();
|
||||
@@ -157,6 +163,7 @@ namespace NzbDrone.Core.Test.NotificationTests
|
||||
notification.SupportsOnReleaseImport.Should().BeFalse();
|
||||
notification.SupportsOnUpgrade.Should().BeFalse();
|
||||
notification.SupportsOnRename.Should().BeFalse();
|
||||
notification.SupportsOnAuthorAdded.Should().BeFalse();
|
||||
notification.SupportsOnAuthorDelete.Should().BeFalse();
|
||||
notification.SupportsOnBookDelete.Should().BeFalse();
|
||||
notification.SupportsOnBookFileDelete.Should().BeFalse();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(038)]
|
||||
public class add_on_author_added_to_notifications : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Notifications").AddColumn("OnAuthorAdded").AsBoolean().WithDefaultValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,7 @@ namespace NzbDrone.Core.Datastore
|
||||
.Ignore(i => i.SupportsOnReleaseImport)
|
||||
.Ignore(i => i.SupportsOnUpgrade)
|
||||
.Ignore(i => i.SupportsOnRename)
|
||||
.Ignore(i => i.SupportsOnAuthorAdded)
|
||||
.Ignore(i => i.SupportsOnAuthorDelete)
|
||||
.Ignore(i => i.SupportsOnBookDelete)
|
||||
.Ignore(i => i.SupportsOnBookFileDelete)
|
||||
|
||||
@@ -592,6 +592,8 @@
|
||||
"NotificationTriggers": "Notification Triggers",
|
||||
"OnApplicationUpdate": "On Application Update",
|
||||
"OnApplicationUpdateHelpText": "On Application Update",
|
||||
"OnAuthorAdded": "On Author Added",
|
||||
"OnAuthorAddedHelpText": "On Author Added",
|
||||
"OnAuthorDelete": "On Author Delete",
|
||||
"OnAuthorDeleteHelpText": "On Author Delete",
|
||||
"OnBookDelete": "On Book Delete",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Apprise
|
||||
{
|
||||
@@ -27,6 +28,11 @@ namespace NzbDrone.Core.Notifications.Apprise
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Boxcar
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -110,6 +110,19 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
var environmentVariables = new StringDictionary();
|
||||
|
||||
environmentVariables.Add("Readarr_EventType", "AuthorAdded");
|
||||
environmentVariables.Add("Readarr_Author_Id", author.Id.ToString());
|
||||
environmentVariables.Add("Readarr_Author_Name", author.Metadata.Value.Name);
|
||||
environmentVariables.Add("Readarr_Author_Path", author.Path);
|
||||
environmentVariables.Add("Readarr_Author_GRId", author.Metadata.Value.ForeignAuthorId);
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
var author = deleteMessage.Author;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
@@ -70,6 +71,28 @@ namespace NzbDrone.Core.Notifications.Discord
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
var attachments = new List<Embed>
|
||||
{
|
||||
new Embed
|
||||
{
|
||||
Title = author.Name,
|
||||
Fields = new List<DiscordField>()
|
||||
{
|
||||
new DiscordField()
|
||||
{
|
||||
Name = "Links",
|
||||
Value = string.Join(" / ", author.Metadata.Value.Links.Select(link => $"[{link.Name}]({link.Url})"))
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
var payload = CreatePayload($"Author Added", attachments);
|
||||
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
var attachments = new List<Embed>
|
||||
|
||||
@@ -8,6 +8,7 @@ using MimeKit;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http.Dispatchers;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Email
|
||||
@@ -43,6 +44,13 @@ namespace NzbDrone.Core.Notifications.Email
|
||||
SendEmail(Settings, BOOK_DOWNLOADED_TITLE_BRANDED, body, false, paths);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
var body = $"{author.Name} added to library.";
|
||||
|
||||
SendEmail(Settings, AUTHOR_ADDED_TITLE_BRANDED, body);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
var body = deleteMessage.Message;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Gotify
|
||||
{
|
||||
@@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.Gotify
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications
|
||||
void OnGrab(GrabMessage grabMessage);
|
||||
void OnReleaseImport(BookDownloadMessage message);
|
||||
void OnRename(Author author, List<RenamedBookFile> renamedFiles);
|
||||
void OnAuthorAdded(Author author);
|
||||
void OnAuthorDelete(AuthorDeleteMessage deleteMessage);
|
||||
void OnBookDelete(BookDeleteMessage deleteMessage);
|
||||
void OnBookFileDelete(BookFileDeleteMessage deleteMessage);
|
||||
@@ -25,6 +26,7 @@ namespace NzbDrone.Core.Notifications
|
||||
bool SupportsOnReleaseImport { get; }
|
||||
bool SupportsOnUpgrade { get; }
|
||||
bool SupportsOnRename { get; }
|
||||
bool SupportsOnAuthorAdded { get; }
|
||||
bool SupportsOnAuthorDelete { get; }
|
||||
bool SupportsOnBookDelete { get; }
|
||||
bool SupportsOnBookFileDelete { get; }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Join
|
||||
{
|
||||
@@ -27,6 +28,11 @@ namespace NzbDrone.Core.Notifications.Join
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE_BRANDED, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITlE_BRANDED, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Mailgun
|
||||
{
|
||||
@@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.Mailgun
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, downloadMessage.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Notifications.Webhook;
|
||||
using NzbDrone.Core.Validation;
|
||||
@@ -30,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Notifiarr
|
||||
_proxy.SendNotification(BuildOnReleaseImportPayload(message), Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(BuildOnAuthorAdded(author), Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(BuildOnAuthorDelete(deleteMessage), Settings);
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications
|
||||
{
|
||||
protected const string BOOK_GRABBED_TITLE = "Book Grabbed";
|
||||
protected const string BOOK_DOWNLOADED_TITLE = "Book Downloaded";
|
||||
protected const string AUTHOR_ADDED_TITLE = "Author Added";
|
||||
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";
|
||||
@@ -23,6 +24,7 @@ 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_ADDED_TITLE_BRANDED = "Readarr - " + AUTHOR_ADDED_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;
|
||||
@@ -57,6 +59,10 @@ namespace NzbDrone.Core.Notifications
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnAuthorAdded(Author author)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
}
|
||||
@@ -95,6 +101,7 @@ namespace NzbDrone.Core.Notifications
|
||||
|
||||
public bool SupportsOnGrab => HasConcreteImplementation("OnGrab");
|
||||
public bool SupportsOnRename => HasConcreteImplementation("OnRename");
|
||||
public bool SupportsOnAuthorAdded => HasConcreteImplementation("OnAuthorAdded");
|
||||
public bool SupportsOnAuthorDelete => HasConcreteImplementation("OnAuthorDelete");
|
||||
public bool SupportsOnBookDelete => HasConcreteImplementation("OnBookDelete");
|
||||
public bool SupportsOnBookFileDelete => HasConcreteImplementation("OnBookFileDelete");
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace NzbDrone.Core.Notifications
|
||||
public bool OnReleaseImport { get; set; }
|
||||
public bool OnUpgrade { get; set; }
|
||||
public bool OnRename { get; set; }
|
||||
public bool OnAuthorAdded { get; set; }
|
||||
public bool OnAuthorDelete { get; set; }
|
||||
public bool OnBookDelete { get; set; }
|
||||
public bool OnBookFileDelete { get; set; }
|
||||
@@ -21,6 +22,7 @@ namespace NzbDrone.Core.Notifications
|
||||
public bool SupportsOnReleaseImport { get; set; }
|
||||
public bool SupportsOnUpgrade { get; set; }
|
||||
public bool SupportsOnRename { get; set; }
|
||||
public bool SupportsOnAuthorAdded { get; set; }
|
||||
public bool SupportsOnAuthorDelete { get; set; }
|
||||
public bool SupportsOnBookDelete { get; set; }
|
||||
public bool SupportsOnBookFileDelete { get; set; }
|
||||
@@ -32,6 +34,6 @@ namespace NzbDrone.Core.Notifications
|
||||
public bool SupportsOnBookRetag { get; set; }
|
||||
public bool SupportsOnApplicationUpdate { get; set; }
|
||||
|
||||
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnAuthorDelete || OnBookDelete || OnBookFileDelete || OnBookFileDeleteForUpgrade || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnBookRetag || OnApplicationUpdate;
|
||||
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnAuthorAdded || OnAuthorDelete || OnBookDelete || OnBookFileDelete || OnBookFileDeleteForUpgrade || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnBookRetag || OnApplicationUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace NzbDrone.Core.Notifications
|
||||
List<INotification> OnUpgradeEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnRenameEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnHealthIssueEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnAuthorAddedEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnAuthorDeleteEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnBookDeleteEnabled(bool filterBlockedNotifications = true);
|
||||
List<INotification> OnBookFileDeleteEnabled(bool filterBlockedNotifications = true);
|
||||
@@ -81,6 +82,16 @@ namespace NzbDrone.Core.Notifications
|
||||
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnRename).ToList();
|
||||
}
|
||||
|
||||
public List<INotification> OnAuthorAddedEnabled(bool filterBlockedNotifications = true)
|
||||
{
|
||||
if (filterBlockedNotifications)
|
||||
{
|
||||
return FilterBlockedNotifications(GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnAuthorAdded)).ToList();
|
||||
}
|
||||
|
||||
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnAuthorAdded).ToList();
|
||||
}
|
||||
|
||||
public List<INotification> OnAuthorDeleteEnabled(bool filterBlockedNotifications = true)
|
||||
{
|
||||
if (filterBlockedNotifications)
|
||||
@@ -195,6 +206,7 @@ namespace NzbDrone.Core.Notifications
|
||||
definition.SupportsOnReleaseImport = provider.SupportsOnReleaseImport;
|
||||
definition.SupportsOnUpgrade = provider.SupportsOnUpgrade;
|
||||
definition.SupportsOnRename = provider.SupportsOnRename;
|
||||
definition.SupportsOnAuthorAdded = provider.SupportsOnAuthorAdded;
|
||||
definition.SupportsOnAuthorDelete = provider.SupportsOnAuthorDelete;
|
||||
definition.SupportsOnBookDelete = provider.SupportsOnBookDelete;
|
||||
definition.SupportsOnBookFileDelete = provider.SupportsOnBookFileDelete;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace NzbDrone.Core.Notifications
|
||||
: IHandle<BookGrabbedEvent>,
|
||||
IHandle<BookImportedEvent>,
|
||||
IHandle<AuthorRenamedEvent>,
|
||||
IHandle<AuthorAddedEvent>,
|
||||
IHandle<AuthorDeletedEvent>,
|
||||
IHandle<BookDeletedEvent>,
|
||||
IHandle<BookFileDeletedEvent>,
|
||||
@@ -211,6 +212,26 @@ namespace NzbDrone.Core.Notifications
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(AuthorAddedEvent message)
|
||||
{
|
||||
foreach (var notification in _notificationFactory.OnAuthorAddedEnabled())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ShouldHandleAuthor(notification.Definition, message.Author))
|
||||
{
|
||||
notification.OnAuthorAdded(message.Author);
|
||||
_notificationStatusService.RecordSuccess(notification.Definition.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_notificationStatusService.RecordFailure(notification.Definition.Id);
|
||||
_logger.Warn(ex, "Unable to send OnAuthorAdded notification to: " + notification.Definition.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(AuthorDeletedEvent message)
|
||||
{
|
||||
var deleteMessage = new AuthorDeleteMessage(message.Author, message.DeleteFiles);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Ntfy
|
||||
{
|
||||
@@ -27,6 +28,11 @@ namespace NzbDrone.Core.Notifications.Ntfy
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Prowl
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Prowl
|
||||
_prowlProxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_prowlProxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_prowlProxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.PushBullet
|
||||
@@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE_BRANDED, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Pushover
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Pushover
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.SendGrid
|
||||
{
|
||||
@@ -29,6 +30,11 @@ namespace NzbDrone.Core.Notifications.SendGrid
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Signal
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Signal
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Simplepush
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Simplepush
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -70,6 +70,21 @@ namespace NzbDrone.Core.Notifications.Slack
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
var attachments = new List<Attachment>
|
||||
{
|
||||
new Attachment
|
||||
{
|
||||
Title = author.Name,
|
||||
}
|
||||
};
|
||||
|
||||
var payload = CreatePayload("Author Added", attachments);
|
||||
|
||||
_proxy.SendPayload(payload, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
var attachments = new List<Attachment>
|
||||
|
||||
@@ -41,6 +41,11 @@ namespace NzbDrone.Core.Notifications.Subsonic
|
||||
Update();
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
Notify(Settings, AUTHOR_ADDED_TITLE_BRANDED, author.Name);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
const string header = "Readarr - Author Deleted";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
|
||||
namespace NzbDrone.Core.Notifications.Telegram
|
||||
{
|
||||
@@ -26,6 +27,11 @@ namespace NzbDrone.Core.Notifications.Telegram
|
||||
_proxy.SendNotification(BOOK_DOWNLOADED_TITLE, message.Message, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_ADDED_TITLE, author.Name, Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendNotification(AUTHOR_DELETED_TITLE, deleteMessage.Message, Settings);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
@@ -28,6 +29,11 @@ namespace NzbDrone.Core.Notifications.Twitter
|
||||
_twitterService.SendNotification($"Imported: {message.Message}", Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_twitterService.SendNotification($"Author added: {author.Name}", Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_twitterService.SendNotification($"Deleted: {deleteMessage.Message}", Settings);
|
||||
|
||||
@@ -35,6 +35,11 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||
_proxy.SendWebhook(BuildOnRenamePayload(author, renamedFiles), Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorAdded(Author author)
|
||||
{
|
||||
_proxy.SendWebhook(BuildOnAuthorAdded(author), Settings);
|
||||
}
|
||||
|
||||
public override void OnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
_proxy.SendWebhook(BuildOnAuthorDelete(deleteMessage), Settings);
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace NzbDrone.Core.Notifications.Webhook
|
||||
{
|
||||
public class WebhookAuthorAddedPayload : WebhookPayload
|
||||
{
|
||||
public WebhookAuthor Author { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,16 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||
};
|
||||
}
|
||||
|
||||
public WebhookAuthorAddedPayload BuildOnAuthorAdded(Author author)
|
||||
{
|
||||
return new WebhookAuthorAddedPayload
|
||||
{
|
||||
EventType = WebhookEventType.AuthorAdded,
|
||||
InstanceName = _configFileProvider.InstanceName,
|
||||
Author = new WebhookAuthor(author)
|
||||
};
|
||||
}
|
||||
|
||||
public WebhookAuthorDeletePayload BuildOnAuthorDelete(AuthorDeleteMessage deleteMessage)
|
||||
{
|
||||
return new WebhookAuthorDeletePayload
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications.Webhook
|
||||
Grab,
|
||||
Download,
|
||||
Rename,
|
||||
AuthorAdded,
|
||||
AuthorDelete,
|
||||
BookDelete,
|
||||
BookFileDelete,
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
public bool OnReleaseImport { get; set; }
|
||||
public bool OnUpgrade { get; set; }
|
||||
public bool OnRename { get; set; }
|
||||
public bool OnAuthorAdded { get; set; }
|
||||
public bool OnAuthorDelete { get; set; }
|
||||
public bool OnBookDelete { get; set; }
|
||||
public bool OnBookFileDelete { get; set; }
|
||||
@@ -22,6 +23,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
public bool SupportsOnReleaseImport { get; set; }
|
||||
public bool SupportsOnUpgrade { get; set; }
|
||||
public bool SupportsOnRename { get; set; }
|
||||
public bool SupportsOnAuthorAdded { get; set; }
|
||||
public bool SupportsOnAuthorDelete { get; set; }
|
||||
public bool SupportsOnBookDelete { get; set; }
|
||||
public bool SupportsOnBookFileDelete { get; set; }
|
||||
@@ -50,6 +52,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
resource.OnReleaseImport = definition.OnReleaseImport;
|
||||
resource.OnUpgrade = definition.OnUpgrade;
|
||||
resource.OnRename = definition.OnRename;
|
||||
resource.OnAuthorAdded = definition.OnAuthorAdded;
|
||||
resource.OnAuthorDelete = definition.OnAuthorDelete;
|
||||
resource.OnBookDelete = definition.OnBookDelete;
|
||||
resource.OnBookFileDelete = definition.OnBookFileDelete;
|
||||
@@ -63,6 +66,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
resource.SupportsOnReleaseImport = definition.SupportsOnReleaseImport;
|
||||
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
|
||||
resource.SupportsOnRename = definition.SupportsOnRename;
|
||||
resource.SupportsOnAuthorAdded = definition.SupportsOnAuthorAdded;
|
||||
resource.SupportsOnAuthorDelete = definition.SupportsOnAuthorDelete;
|
||||
resource.SupportsOnBookDelete = definition.SupportsOnBookDelete;
|
||||
resource.SupportsOnBookFileDelete = definition.SupportsOnBookFileDelete;
|
||||
@@ -90,6 +94,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
definition.OnReleaseImport = resource.OnReleaseImport;
|
||||
definition.OnUpgrade = resource.OnUpgrade;
|
||||
definition.OnRename = resource.OnRename;
|
||||
definition.OnAuthorAdded = resource.OnAuthorAdded;
|
||||
definition.OnAuthorDelete = resource.OnAuthorDelete;
|
||||
definition.OnBookDelete = resource.OnBookDelete;
|
||||
definition.OnBookFileDelete = resource.OnBookFileDelete;
|
||||
@@ -103,6 +108,7 @@ namespace Readarr.Api.V1.Notifications
|
||||
definition.SupportsOnReleaseImport = resource.SupportsOnReleaseImport;
|
||||
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
|
||||
definition.SupportsOnRename = resource.SupportsOnRename;
|
||||
definition.SupportsOnAuthorAdded = resource.SupportsOnAuthorAdded;
|
||||
definition.SupportsOnAuthorDelete = resource.SupportsOnAuthorDelete;
|
||||
definition.SupportsOnBookDelete = resource.SupportsOnBookDelete;
|
||||
definition.SupportsOnBookFileDelete = resource.SupportsOnBookFileDelete;
|
||||
|
||||
Reference in New Issue
Block a user