New: OnApplicationUpdate Notifications

* Added translations

Fixes #2552
[common]

(cherry picked from commit 9e175e28efcfc6ac3e414649b955a10fb0e951e7)
This commit is contained in:
Qstick 2021-12-20 23:12:12 -06:00
parent 8864344552
commit 67c96f0b89
34 changed files with 307 additions and 16 deletions

View File

@ -63,6 +63,7 @@ class Notification extends Component {
onDownloadFailure,
onImportFailure,
onTrackRetag,
onApplicationUpdate,
supportsOnGrab,
supportsOnReleaseImport,
supportsOnUpgrade,
@ -70,7 +71,8 @@ class Notification extends Component {
supportsOnHealthIssue,
supportsOnDownloadFailure,
supportsOnImportFailure,
supportsOnTrackRetag
supportsOnTrackRetag,
supportsOnApplicationUpdate
} = this.props;
return (
@ -86,62 +88,69 @@ class Notification extends Component {
{
supportsOnGrab && onGrab &&
<Label kind={kinds.SUCCESS}>
On Grab
{translate('OnGrab')}
</Label>
}
{
supportsOnReleaseImport && onReleaseImport &&
<Label kind={kinds.SUCCESS}>
On Release Import
{translate('OnReleaseImport')}
</Label>
}
{
supportsOnUpgrade && onReleaseImport && onUpgrade &&
<Label kind={kinds.SUCCESS}>
On Upgrade
{translate('OnUpgrade')}
</Label>
}
{
supportsOnRename && onRename &&
<Label kind={kinds.SUCCESS}>
On Rename
{translate('OnRename')}
</Label>
}
{
supportsOnTrackRetag && onTrackRetag &&
<Label kind={kinds.SUCCESS}>
On Track Tag Update
{translate('OnTrackRetag')}
</Label>
}
{
supportsOnHealthIssue && onHealthIssue &&
<Label kind={kinds.SUCCESS}>
On Health Issue
{translate('OnHealthIssue')}
</Label>
}
{
supportsOnDownloadFailure && onDownloadFailure &&
<Label kind={kinds.SUCCESS} >
On Download Failure
{translate('OnDownloadFailure')}
</Label>
}
{
supportsOnImportFailure && onImportFailure &&
<Label kind={kinds.SUCCESS} >
On Import Failure
{translate('OnImportFailure')}
</Label>
}
{
supportsOnApplicationUpdate && onApplicationUpdate &&
<Label kind={kinds.SUCCESS} >
{translate('OnApplicationUpdate')}
</Label>
}
{
!onGrab && !onReleaseImport && !onRename && !onTrackRetag &&
!onHealthIssue && !onDownloadFailure && !onImportFailure &&
!onHealthIssue && !onDownloadFailure && !onImportFailure && !onApplicationUpdate &&
<Label
kind={kinds.DISABLED}
outline={true}
@ -182,6 +191,7 @@ Notification.propTypes = {
onDownloadFailure: PropTypes.bool.isRequired,
onImportFailure: PropTypes.bool.isRequired,
onTrackRetag: PropTypes.bool.isRequired,
onApplicationUpdate: PropTypes.bool.isRequired,
supportsOnGrab: PropTypes.bool.isRequired,
supportsOnReleaseImport: PropTypes.bool.isRequired,
supportsOnUpgrade: PropTypes.bool.isRequired,
@ -190,6 +200,7 @@ Notification.propTypes = {
supportsOnDownloadFailure: PropTypes.bool.isRequired,
supportsOnImportFailure: PropTypes.bool.isRequired,
supportsOnTrackRetag: PropTypes.bool.isRequired,
supportsOnApplicationUpdate: PropTypes.bool.isRequired,
onConfirmDeleteNotification: PropTypes.func.isRequired
};

View File

@ -23,6 +23,7 @@ function NotificationEventItems(props) {
onDownloadFailure,
onImportFailure,
onTrackRetag,
onApplicationUpdate,
supportsOnGrab,
supportsOnReleaseImport,
supportsOnUpgrade,
@ -31,7 +32,8 @@ function NotificationEventItems(props) {
includeHealthWarnings,
supportsOnDownloadFailure,
supportsOnImportFailure,
supportsOnTrackRetag
supportsOnTrackRetag,
supportsOnApplicationUpdate
} = item;
return (
@ -125,6 +127,17 @@ function NotificationEventItems(props) {
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onApplicationUpdate"
helpText={translate('OnApplicationUpdateHelpText')}
isDisabled={!supportsOnApplicationUpdate.value}
{...onApplicationUpdate}
onChange={onInputChange}
/>
</div>
<div>
<FormInputGroup
type={inputTypes.CHECK}
@ -149,6 +162,7 @@ function NotificationEventItems(props) {
/>
</div>
}
</div>
</div>
</FormGroup>

View File

@ -110,6 +110,7 @@ export default {
selectedSchema.onDownloadFailure = selectedSchema.supportsOnDownloadFailure;
selectedSchema.onImportFailure = selectedSchema.supportsOnImportFailure;
selectedSchema.onTrackRetag = selectedSchema.supportsOnTrackRetag;
selectedSchema.onApplicationUpdate = selectedSchema.supportsOnApplicationUpdate;
return selectedSchema;
});

View File

@ -13,6 +13,7 @@ namespace Lidarr.Api.V1.Notifications
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
public bool OnTrackRetag { get; set; }
public bool OnApplicationUpdate { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
@ -22,6 +23,7 @@ namespace Lidarr.Api.V1.Notifications
public bool SupportsOnDownloadFailure { get; set; }
public bool SupportsOnImportFailure { get; set; }
public bool SupportsOnTrackRetag { get; set; }
public bool SupportsOnApplicationUpdate { get; set; }
public string TestCommand { get; set; }
}
@ -44,6 +46,7 @@ namespace Lidarr.Api.V1.Notifications
resource.OnDownloadFailure = definition.OnDownloadFailure;
resource.OnImportFailure = definition.OnImportFailure;
resource.OnTrackRetag = definition.OnTrackRetag;
resource.OnApplicationUpdate = definition.OnApplicationUpdate;
resource.SupportsOnGrab = definition.SupportsOnGrab;
resource.SupportsOnReleaseImport = definition.SupportsOnReleaseImport;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
@ -53,6 +56,7 @@ namespace Lidarr.Api.V1.Notifications
resource.SupportsOnDownloadFailure = definition.SupportsOnDownloadFailure;
resource.SupportsOnImportFailure = definition.SupportsOnImportFailure;
resource.SupportsOnTrackRetag = definition.SupportsOnTrackRetag;
resource.SupportsOnApplicationUpdate = definition.SupportsOnApplicationUpdate;
return resource;
}
@ -74,6 +78,7 @@ namespace Lidarr.Api.V1.Notifications
definition.OnDownloadFailure = resource.OnDownloadFailure;
definition.OnImportFailure = resource.OnImportFailure;
definition.OnTrackRetag = resource.OnTrackRetag;
definition.OnApplicationUpdate = resource.OnApplicationUpdate;
definition.SupportsOnGrab = resource.SupportsOnGrab;
definition.SupportsOnReleaseImport = resource.SupportsOnReleaseImport;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
@ -83,6 +88,7 @@ namespace Lidarr.Api.V1.Notifications
definition.SupportsOnDownloadFailure = resource.SupportsOnDownloadFailure;
definition.SupportsOnImportFailure = resource.SupportsOnImportFailure;
definition.SupportsOnTrackRetag = resource.SupportsOnTrackRetag;
definition.SupportsOnApplicationUpdate = resource.SupportsOnApplicationUpdate;
return definition;
}

View File

@ -81,6 +81,11 @@ namespace NzbDrone.Core.Test.NotificationTests
{
TestLogger.Info("OnTrackRetag was called");
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
TestLogger.Info("OnApplicationUpdate was called");
}
}
private class TestNotificationWithNoEvents : NotificationBase<TestSetting>
@ -119,6 +124,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnDownloadFailure.Should().BeTrue();
notification.SupportsOnImportFailure.Should().BeTrue();
notification.SupportsOnTrackRetag.Should().BeTrue();
notification.SupportsOnApplicationUpdate.Should().BeTrue();
}
[Test]
@ -134,6 +140,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnDownloadFailure.Should().BeFalse();
notification.SupportsOnImportFailure.Should().BeFalse();
notification.SupportsOnTrackRetag.Should().BeFalse();
notification.SupportsOnApplicationUpdate.Should().BeFalse();
}
}
}

View File

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(054)]
public class add_on_update_to_notifications : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Notifications").AddColumn("OnApplicationUpdate").AsBoolean().WithDefaultValue(true);
}
}
}

View File

@ -85,7 +85,8 @@ namespace NzbDrone.Core.Datastore
.Ignore(i => i.SupportsOnHealthIssue)
.Ignore(i => i.SupportsOnDownloadFailure)
.Ignore(i => i.SupportsOnImportFailure)
.Ignore(i => i.SupportsOnTrackRetag);
.Ignore(i => i.SupportsOnTrackRetag)
.Ignore(i => i.SupportsOnApplicationUpdate);
Mapper.Entity<MetadataDefinition>("Metadata").RegisterModel()
.Ignore(x => x.ImplementationName)

View File

@ -375,13 +375,23 @@
"NoTagsHaveBeenAddedYetAddTagsToLinkArtistsWithDelayProfilesRestrictionsOrNotificationsClickLinkTohttpswikiservarrcomlidarrsettingstagshereLinkToFindOutMoreAboutTagsInLidarr": "No tags have been added yet. Add tags to link artists with delay profiles, restrictions, or notifications. Click <Link to='https://wiki.servarr.com/lidarr/settings#tags'>here</Link> to find out more about tags in Lidarr.",
"NotificationTriggers": "Notification Triggers",
"NoUpdatesAreAvailable": "No updates are available",
"OnApplicationUpdate": "On Application Update",
"OnApplicationUpdateHelpText": "On Application 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",
"OnTrackRetag": "On Track Retag",
"OnTrackRetagHelpText": "On Track Retag",
"OnUpgrade": "On Upgrade",
"OnUpgradeHelpText": "On Upgrade",
"OpenBrowserOnStart": "Open browser on start",
"Options": "Options",

View File

@ -0,0 +1,16 @@
using System;
namespace NzbDrone.Core.Notifications
{
public class ApplicationUpdateMessage
{
public string Message { get; set; }
public Version PreviousVersion { get; set; }
public Version NewVersion { get; set; }
public override string ToString()
{
return NewVersion.ToString();
}
}
}

View File

@ -41,6 +41,11 @@ namespace NzbDrone.Core.Notifications.Boxcar
_proxy.SendNotification(IMPORT_FAILURE_TITLE, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage message)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, message.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -155,6 +155,18 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var environmentVariables = new StringDictionary();
environmentVariables.Add("Lidarr_EventType", "ApplicationUpdate");
environmentVariables.Add("Lidarr_Update_Message", updateMessage.Message);
environmentVariables.Add("Lidarr_Update_NewVersion", updateMessage.NewVersion.ToString());
environmentVariables.Add("Lidarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
ExecuteScript(environmentVariables);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -309,6 +309,41 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var attachments = new List<Embed>
{
new Embed
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/lidarr/Lidarr/develop/Logo/256.png"
},
Title = APPLICATION_UPDATE_TITLE,
Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
Color = (int)DiscordColors.Standard,
Fields = new List<DiscordField>()
{
new DiscordField()
{
Name = "Previous Version",
Value = updateMessage.PreviousVersion.ToString()
},
new DiscordField()
{
Name = "New Version",
Value = updateMessage.NewVersion.ToString()
}
},
}
};
var payload = CreatePayload(null, attachments);
_proxy.SendPayload(payload, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -52,6 +52,13 @@ namespace NzbDrone.Core.Notifications.Email
SendEmail(Settings, IMPORT_FAILURE_TITLE_BRANDED, message.Message);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var body = $"{updateMessage.Message}";
SendEmail(Settings, APPLICATION_UPDATE_TITLE_BRANDED, body);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -44,6 +44,11 @@ namespace NzbDrone.Core.Notifications.Gotify
_proxy.SendNotification(IMPORT_FAILURE_TITLE, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -11,6 +11,7 @@ namespace NzbDrone.Core.Notifications
void OnReleaseImport(AlbumDownloadMessage message);
void OnRename(Artist artist);
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnApplicationUpdate(ApplicationUpdateMessage updateMessage);
void OnDownloadFailure(DownloadFailedMessage message);
void OnImportFailure(AlbumDownloadMessage message);
void OnTrackRetag(TrackRetagMessage message);
@ -20,6 +21,7 @@ namespace NzbDrone.Core.Notifications
bool SupportsOnUpgrade { get; }
bool SupportsOnRename { get; }
bool SupportsOnHealthIssue { get; }
bool SupportsOnApplicationUpdate { get; }
bool SupportsOnDownloadFailure { get; }
bool SupportsOnImportFailure { get; }
bool SupportsOnTrackRetag { get; }

View File

@ -32,6 +32,11 @@ namespace NzbDrone.Core.Notifications.Join
_proxy.SendNotification(HEALTH_ISSUE_TITLE_BRANDED, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -34,6 +34,11 @@ namespace NzbDrone.Core.Notifications.Mailgun
_proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheckMessage.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -62,6 +62,14 @@ namespace NzbDrone.Core.Notifications.Emby
}
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
if (Settings.Notify)
{
_mediaBrowserService.Notify(Settings, APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message);
}
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -96,6 +96,18 @@ namespace NzbDrone.Core.Notifications.Notifiarr
_proxy.SendNotification(variables, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var variables = new StringDictionary();
variables.Add("Lidarr_EventType", "ApplicationUpdate");
variables.Add("Lidarr_Update_Message", updateMessage.Message);
variables.Add("Lidarr_Update_NewVersion", updateMessage.NewVersion.ToString());
variables.Add("Lidarr_Update_PreviousVersion", updateMessage.PreviousVersion.ToString());
_proxy.SendNotification(variables, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -15,6 +15,7 @@ namespace NzbDrone.Core.Notifications
protected const string DOWNLOAD_FAILURE_TITLE = "Download Failed";
protected const string IMPORT_FAILURE_TITLE = "Import Failed";
protected const string TRACK_RETAGGED_TITLE = "Track File Tags Updated";
protected const string APPLICATION_UPDATE_TITLE = "Application Updated";
protected const string ALBUM_GRABBED_TITLE_BRANDED = "Lidarr - " + ALBUM_GRABBED_TITLE;
protected const string ALBUM_DOWNLOADED_TITLE_BRANDED = "Lidarr - " + ALBUM_DOWNLOADED_TITLE;
@ -22,6 +23,7 @@ namespace NzbDrone.Core.Notifications
protected const string DOWNLOAD_FAILURE_TITLE_BRANDED = "Lidarr - " + DOWNLOAD_FAILURE_TITLE;
protected const string IMPORT_FAILURE_TITLE_BRANDED = "Lidarr - " + IMPORT_FAILURE_TITLE;
protected const string TRACK_RETAGGED_TITLE_BRANDED = "Lidarr - " + TRACK_RETAGGED_TITLE;
protected const string APPLICATION_UPDATE_TITLE_BRANDED = "Lidarr - " + APPLICATION_UPDATE_TITLE;
public abstract string Name { get; }
@ -64,6 +66,10 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
}
public virtual void ProcessQueue()
{
}
@ -76,6 +82,7 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnDownloadFailure => HasConcreteImplementation("OnDownloadFailure");
public bool SupportsOnImportFailure => HasConcreteImplementation("OnImportFailure");
public bool SupportsOnTrackRetag => HasConcreteImplementation("OnTrackRetag");
public bool SupportsOnApplicationUpdate => HasConcreteImplementation("OnApplicationUpdate");
protected TSettings Settings => (TSettings)Definition.Settings;

View File

@ -12,6 +12,7 @@ namespace NzbDrone.Core.Notifications
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
public bool OnTrackRetag { get; set; }
public bool OnApplicationUpdate { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
@ -21,7 +22,8 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnDownloadFailure { get; set; }
public bool SupportsOnImportFailure { get; set; }
public bool SupportsOnTrackRetag { get; set; }
public bool SupportsOnApplicationUpdate { get; set; }
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnTrackRetag;
public override bool Enable => OnGrab || OnReleaseImport || (OnReleaseImport && OnUpgrade) || OnHealthIssue || OnDownloadFailure || OnImportFailure || OnTrackRetag || OnApplicationUpdate;
}
}

View File

@ -18,6 +18,7 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnDownloadFailureEnabled();
List<INotification> OnImportFailureEnabled();
List<INotification> OnTrackRetagEnabled();
List<INotification> OnApplicationUpdateEnabled();
}
public class NotificationFactory : ProviderFactory<INotification, NotificationDefinition>, INotificationFactory
@ -67,6 +68,11 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnTrackRetag).ToList();
}
public List<INotification> OnApplicationUpdateEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnApplicationUpdate).ToList();
}
public override void SetProviderCharacteristics(INotification provider, NotificationDefinition definition)
{
base.SetProviderCharacteristics(provider, definition);
@ -79,6 +85,7 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnDownloadFailure = provider.SupportsOnDownloadFailure;
definition.SupportsOnImportFailure = provider.SupportsOnImportFailure;
definition.SupportsOnTrackRetag = provider.SupportsOnTrackRetag;
definition.SupportsOnApplicationUpdate = provider.SupportsOnApplicationUpdate;
}
}
}

View File

@ -11,6 +11,7 @@ using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Music;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Update.History.Events;
namespace NzbDrone.Core.Notifications
{
@ -23,7 +24,8 @@ namespace NzbDrone.Core.Notifications
IHandle<AlbumImportIncompleteEvent>,
IHandle<TrackFileRetaggedEvent>,
IHandleAsync<RenameCompletedEvent>,
IHandleAsync<HealthCheckCompleteEvent>
IHandleAsync<HealthCheckCompleteEvent>,
IHandle<UpdateInstalledEvent>
{
private readonly INotificationFactory _notificationFactory;
private readonly Logger _logger;
@ -75,7 +77,7 @@ namespace NzbDrone.Core.Notifications
{
return string.Format("{0}:\n{1}",
trackFile.Path,
string.Join("\n", diff.Select(x => $"{x.Key}: {FormatMissing(x.Value.Item1)} {FormatMissing(x.Value.Item2)}")));
string.Join("\n", diff.Select(x => $"{x.Key}: {FormatMissing(x.Value.Item1)} ? {FormatMissing(x.Value.Item2)}")));
}
private bool ShouldHandleArtist(ProviderDefinition definition, Artist artist)
@ -275,6 +277,26 @@ namespace NzbDrone.Core.Notifications
}
}
public void Handle(UpdateInstalledEvent message)
{
var updateMessage = new ApplicationUpdateMessage();
updateMessage.Message = $"Lidarr updated from {message.PreviousVerison.ToString()} to {message.NewVersion.ToString()}";
updateMessage.PreviousVersion = message.PreviousVerison;
updateMessage.NewVersion = message.NewVersion;
foreach (var notification in _notificationFactory.OnApplicationUpdateEnabled())
{
try
{
notification.OnApplicationUpdate(updateMessage);
}
catch (Exception ex)
{
_logger.Warn(ex, "Unable to send OnApplicationUpdate notification to: " + notification.Definition.Name);
}
}
}
public void HandleAsync(RenameCompletedEvent message)
{
ProcessQueue();

View File

@ -31,6 +31,11 @@ namespace NzbDrone.Core.Notifications.Prowl
_prowlProxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_prowlProxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -44,6 +44,11 @@ namespace NzbDrone.Core.Notifications.PushBullet
_proxy.SendNotification(IMPORT_FAILURE_TITLE_BRANDED, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -41,6 +41,11 @@ namespace NzbDrone.Core.Notifications.Pushover
_proxy.SendNotification(IMPORT_FAILURE_TITLE, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -44,6 +44,11 @@ namespace NzbDrone.Core.Notifications.SendGrid
_proxy.SendNotification(IMPORT_FAILURE_TITLE, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -135,6 +135,23 @@ namespace NzbDrone.Core.Notifications.Slack
_proxy.SendPayload(payload, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var attachments = new List<Attachment>
{
new Attachment
{
Title = Environment.MachineName,
Text = updateMessage.Message,
Color = "good"
}
};
var payload = CreatePayload("Application Updated", attachments);
_proxy.SendPayload(payload, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -41,6 +41,11 @@ namespace NzbDrone.Core.Notifications.Telegram
_proxy.SendNotification(IMPORT_FAILURE_TITLE, message.Message, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings);
}
public override ValidationResult Test()
{
var failures = new List<ValidationFailure>();

View File

@ -43,6 +43,11 @@ namespace NzbDrone.Core.Notifications.Twitter
_twitterService.SendNotification($"Import Failed: {message.Message}", Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
_twitterService.SendNotification($"Application Updated: {updateMessage.Message}", Settings);
}
public override object RequestAction(string action, IDictionary<string, string> query)
{
if (action == "startOAuth")

View File

@ -102,6 +102,19 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(payload, Settings);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
var payload = new WebhookApplicationUpdatePayload
{
EventType = WebhookEventType.ApplicationUpdate,
Message = updateMessage.Message,
PreviousVersion = updateMessage.PreviousVersion.ToString(),
NewVersion = updateMessage.NewVersion.ToString()
};
_proxy.SendWebhook(payload, Settings);
}
public override string Name => "Webhook";
public override ValidationResult Test()

View File

@ -0,0 +1,11 @@
using NzbDrone.Core.HealthCheck;
namespace NzbDrone.Core.Notifications.Webhook
{
public class WebhookApplicationUpdatePayload : WebhookPayload
{
public string Message { get; set; }
public string PreviousVersion { get; set; }
public string NewVersion { get; set; }
}
}

View File

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Notifications.Webhook
Download,
Rename,
Health,
Retag
Retag,
ApplicationUpdate
}
}

View File

@ -51,6 +51,11 @@ namespace NzbDrone.Core.Notifications.Xbmc
UpdateAndClean(message.Artist);
}
public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage)
{
Notify(Settings, APPLICATION_UPDATE_TITLE_BRANDED, updateMessage.Message);
}
public override string Name => "Kodi";
public override ValidationResult Test()