Custom Notification cleanup

- Renamed event "BookDownload" to "Download" to match sonarr/radarr
- Renamed "TrackRetag" to "BookRetag" (Lidarr leftovers)
pull/529/head
nitsua 4 years ago committed by Qstick
parent 533e239d72
commit 0672fc7b85

@ -61,7 +61,7 @@ class Notification extends Component {
onHealthIssue,
onDownloadFailure,
onImportFailure,
onTrackRetag,
onBookRetag,
supportsOnGrab,
supportsOnReleaseImport,
supportsOnUpgrade,
@ -69,7 +69,7 @@ class Notification extends Component {
supportsOnHealthIssue,
supportsOnDownloadFailure,
supportsOnImportFailure,
supportsOnTrackRetag
supportsOnBookRetag
} = this.props;
return (
@ -111,9 +111,9 @@ class Notification extends Component {
}
{
supportsOnTrackRetag && onTrackRetag &&
supportsOnBookRetag && onBookRetag &&
<Label kind={kinds.SUCCESS}>
On Track Tag Update
On Book Tag Update
</Label>
}
@ -139,7 +139,7 @@ class Notification extends Component {
}
{
!onGrab && !onReleaseImport && !onRename && !onTrackRetag &&
!onGrab && !onReleaseImport && !onRename && !onBookRetag &&
!onHealthIssue && !onDownloadFailure && !onImportFailure &&
<Label
kind={kinds.DISABLED}
@ -180,7 +180,7 @@ Notification.propTypes = {
onHealthIssue: PropTypes.bool.isRequired,
onDownloadFailure: PropTypes.bool.isRequired,
onImportFailure: PropTypes.bool.isRequired,
onTrackRetag: PropTypes.bool.isRequired,
onBookRetag: PropTypes.bool.isRequired,
supportsOnGrab: PropTypes.bool.isRequired,
supportsOnReleaseImport: PropTypes.bool.isRequired,
supportsOnUpgrade: PropTypes.bool.isRequired,
@ -188,7 +188,7 @@ Notification.propTypes = {
supportsOnHealthIssue: PropTypes.bool.isRequired,
supportsOnDownloadFailure: PropTypes.bool.isRequired,
supportsOnImportFailure: PropTypes.bool.isRequired,
supportsOnTrackRetag: PropTypes.bool.isRequired,
supportsOnBookRetag: PropTypes.bool.isRequired,
onConfirmDeleteNotification: PropTypes.func.isRequired
};

@ -21,7 +21,7 @@ function NotificationEventItems(props) {
onHealthIssue,
onDownloadFailure,
onImportFailure,
onTrackRetag,
onBookRetag,
supportsOnGrab,
supportsOnReleaseImport,
supportsOnUpgrade,
@ -30,7 +30,7 @@ function NotificationEventItems(props) {
includeHealthWarnings,
supportsOnDownloadFailure,
supportsOnImportFailure,
supportsOnTrackRetag
supportsOnBookRetag
} = item;
return (
@ -114,10 +114,10 @@ function NotificationEventItems(props) {
<div>
<FormInputGroup
type={inputTypes.CHECK}
name="onTrackRetag"
helpText="On Track Retag"
isDisabled={!supportsOnTrackRetag.value}
{...onTrackRetag}
name="onBookRetag"
helpText="On Book Retag"
isDisabled={!supportsOnBookRetag.value}
{...onBookRetag}
onChange={onInputChange}
/>
</div>

@ -109,7 +109,7 @@ export default {
selectedSchema.onHealthIssue = selectedSchema.supportsOnHealthIssue;
selectedSchema.onDownloadFailure = selectedSchema.supportsOnDownloadFailure;
selectedSchema.onImportFailure = selectedSchema.supportsOnImportFailure;
selectedSchema.onTrackRetag = selectedSchema.supportsOnTrackRetag;
selectedSchema.onBookRetag = selectedSchema.supportsOnBookRetag;
return selectedSchema;
});

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.NotificationTests
public override void OnReleaseImport(BookDownloadMessage message)
{
TestLogger.Info("OnAlbumDownload was called");
TestLogger.Info("OnDownload was called");
}
public override void OnRename(Author artist)
@ -77,9 +77,9 @@ namespace NzbDrone.Core.Test.NotificationTests
TestLogger.Info("OnImportFailure was called");
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
TestLogger.Info("OnTrackRetag was called");
TestLogger.Info("OnBookRetag was called");
}
}
@ -118,7 +118,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnHealthIssue.Should().BeTrue();
notification.SupportsOnDownloadFailure.Should().BeTrue();
notification.SupportsOnImportFailure.Should().BeTrue();
notification.SupportsOnTrackRetag.Should().BeTrue();
notification.SupportsOnBookRetag.Should().BeTrue();
}
[Test]
@ -133,7 +133,7 @@ namespace NzbDrone.Core.Test.NotificationTests
notification.SupportsOnHealthIssue.Should().BeFalse();
notification.SupportsOnDownloadFailure.Should().BeFalse();
notification.SupportsOnImportFailure.Should().BeFalse();
notification.SupportsOnTrackRetag.Should().BeFalse();
notification.SupportsOnBookRetag.Should().BeFalse();
}
}
}

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(004)]
public class rename_supports_on_track_retag : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Rename.Column("OnTrackRetag").OnTable("Notifications").To("OnBookRetag");
}
}
}

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

@ -64,7 +64,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
var book = message.Book;
var environmentVariables = new StringDictionary();
environmentVariables.Add("Readarr_EventType", "BookDownload");
environmentVariables.Add("Readarr_EventType", "Download");
environmentVariables.Add("Readarr_Author_Id", author.Id.ToString());
environmentVariables.Add("Readarr_Author_Name", author.Metadata.Value.Name);
environmentVariables.Add("Readarr_Author_Path", author.Path);
@ -78,7 +78,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
if (message.BookFiles.Any())
{
environmentVariables.Add("Readarr_AddedTrackPaths", string.Join("|", message.BookFiles.Select(e => e.Path)));
environmentVariables.Add("Readarr_AddedFilePaths", string.Join("|", message.BookFiles.Select(e => e.Path)));
}
if (message.OldFiles.Any())
@ -102,7 +102,7 @@ namespace NzbDrone.Core.Notifications.CustomScript
ExecuteScript(environmentVariables);
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
var author = message.Author;
var book = message.Book;

@ -86,7 +86,7 @@ namespace NzbDrone.Core.Notifications.Discord
_proxy.SendPayload(payload, Settings);
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
var attachments = new List<Embed>
{

@ -13,7 +13,7 @@ namespace NzbDrone.Core.Notifications
void OnHealthIssue(HealthCheck.HealthCheck healthCheck);
void OnDownloadFailure(DownloadFailedMessage message);
void OnImportFailure(BookDownloadMessage message);
void OnTrackRetag(BookRetagMessage message);
void OnBookRetag(BookRetagMessage message);
bool SupportsOnGrab { get; }
bool SupportsOnReleaseImport { get; }
bool SupportsOnUpgrade { get; }
@ -21,6 +21,6 @@ namespace NzbDrone.Core.Notifications
bool SupportsOnHealthIssue { get; }
bool SupportsOnDownloadFailure { get; }
bool SupportsOnImportFailure { get; }
bool SupportsOnTrackRetag { get; }
bool SupportsOnBookRetag { get; }
}
}

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Notifications
{
}
public virtual void OnTrackRetag(BookRetagMessage message)
public virtual void OnBookRetag(BookRetagMessage message)
{
}
@ -71,7 +71,7 @@ namespace NzbDrone.Core.Notifications
public bool SupportsOnHealthIssue => HasConcreteImplementation("OnHealthIssue");
public bool SupportsOnDownloadFailure => HasConcreteImplementation("OnDownloadFailure");
public bool SupportsOnImportFailure => HasConcreteImplementation("OnImportFailure");
public bool SupportsOnTrackRetag => HasConcreteImplementation("OnTrackRetag");
public bool SupportsOnBookRetag => HasConcreteImplementation("OnBookRetag");
protected TSettings Settings => (TSettings)Definition.Settings;

@ -11,7 +11,7 @@ namespace NzbDrone.Core.Notifications
public bool OnHealthIssue { get; set; }
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
public bool OnTrackRetag { get; set; }
public bool OnBookRetag { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
@ -20,8 +20,8 @@ namespace NzbDrone.Core.Notifications
public bool IncludeHealthWarnings { get; set; }
public bool SupportsOnDownloadFailure { get; set; }
public bool SupportsOnImportFailure { get; set; }
public bool SupportsOnTrackRetag { get; set; }
public bool SupportsOnBookRetag { 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 || OnBookRetag;
}
}

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Notifications
List<INotification> OnHealthIssueEnabled();
List<INotification> OnDownloadFailureEnabled();
List<INotification> OnImportFailureEnabled();
List<INotification> OnTrackRetagEnabled();
List<INotification> OnBookRetagEnabled();
}
public class NotificationFactory : ProviderFactory<INotification, NotificationDefinition>, INotificationFactory
@ -61,9 +61,9 @@ namespace NzbDrone.Core.Notifications
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnImportFailure).ToList();
}
public List<INotification> OnTrackRetagEnabled()
public List<INotification> OnBookRetagEnabled()
{
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnTrackRetag).ToList();
return GetAvailableProviders().Where(n => ((NotificationDefinition)n.Definition).OnBookRetag).ToList();
}
public override void SetProviderCharacteristics(INotification provider, NotificationDefinition definition)
@ -77,7 +77,7 @@ namespace NzbDrone.Core.Notifications
definition.SupportsOnHealthIssue = provider.SupportsOnHealthIssue;
definition.SupportsOnDownloadFailure = provider.SupportsOnDownloadFailure;
definition.SupportsOnImportFailure = provider.SupportsOnImportFailure;
definition.SupportsOnTrackRetag = provider.SupportsOnTrackRetag;
definition.SupportsOnBookRetag = provider.SupportsOnBookRetag;
}
}
}

@ -262,11 +262,11 @@ namespace NzbDrone.Core.Notifications
Scrubbed = message.Scrubbed
};
foreach (var notification in _notificationFactory.OnTrackRetagEnabled())
foreach (var notification in _notificationFactory.OnBookRetagEnabled())
{
if (ShouldHandleArtist(notification.Definition, message.Author))
{
notification.OnTrackRetag(retagMessage);
notification.OnBookRetag(retagMessage);
}
}
}

@ -86,7 +86,7 @@ namespace NzbDrone.Core.Notifications.Slack
_proxy.SendPayload(payload, Settings);
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
var attachments = new List<Attachment>
{

@ -45,7 +45,7 @@ namespace NzbDrone.Core.Notifications.Subsonic
Notify(Settings, HEALTH_ISSUE_TITLE_BRANDED, healthCheck.Message);
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
Notify(Settings, BOOK_RETAGGED_TITLE_BRANDED, message.Message);
}

@ -46,7 +46,7 @@ namespace NzbDrone.Core.Notifications.Synology
}
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
if (Settings.UpdateLibrary)
{

@ -67,7 +67,7 @@ namespace NzbDrone.Core.Notifications.Webhook
_proxy.SendWebhook(payload, Settings);
}
public override void OnTrackRetag(BookRetagMessage message)
public override void OnBookRetag(BookRetagMessage message)
{
var payload = new WebhookPayload
{

@ -12,7 +12,7 @@ namespace Readarr.Api.V1.Notifications
public bool OnHealthIssue { get; set; }
public bool OnDownloadFailure { get; set; }
public bool OnImportFailure { get; set; }
public bool OnTrackRetag { get; set; }
public bool OnBookRetag { get; set; }
public bool SupportsOnGrab { get; set; }
public bool SupportsOnReleaseImport { get; set; }
public bool SupportsOnUpgrade { get; set; }
@ -21,7 +21,7 @@ namespace Readarr.Api.V1.Notifications
public bool IncludeHealthWarnings { get; set; }
public bool SupportsOnDownloadFailure { get; set; }
public bool SupportsOnImportFailure { get; set; }
public bool SupportsOnTrackRetag { get; set; }
public bool SupportsOnBookRetag { get; set; }
public string TestCommand { get; set; }
}
@ -43,7 +43,7 @@ namespace Readarr.Api.V1.Notifications
resource.OnHealthIssue = definition.OnHealthIssue;
resource.OnDownloadFailure = definition.OnDownloadFailure;
resource.OnImportFailure = definition.OnImportFailure;
resource.OnTrackRetag = definition.OnTrackRetag;
resource.OnBookRetag = definition.OnBookRetag;
resource.SupportsOnGrab = definition.SupportsOnGrab;
resource.SupportsOnReleaseImport = definition.SupportsOnReleaseImport;
resource.SupportsOnUpgrade = definition.SupportsOnUpgrade;
@ -52,7 +52,7 @@ namespace Readarr.Api.V1.Notifications
resource.IncludeHealthWarnings = definition.IncludeHealthWarnings;
resource.SupportsOnDownloadFailure = definition.SupportsOnDownloadFailure;
resource.SupportsOnImportFailure = definition.SupportsOnImportFailure;
resource.SupportsOnTrackRetag = definition.SupportsOnTrackRetag;
resource.SupportsOnBookRetag = definition.SupportsOnBookRetag;
return resource;
}
@ -73,7 +73,7 @@ namespace Readarr.Api.V1.Notifications
definition.OnHealthIssue = resource.OnHealthIssue;
definition.OnDownloadFailure = resource.OnDownloadFailure;
definition.OnImportFailure = resource.OnImportFailure;
definition.OnTrackRetag = resource.OnTrackRetag;
definition.OnBookRetag = resource.OnBookRetag;
definition.SupportsOnGrab = resource.SupportsOnGrab;
definition.SupportsOnReleaseImport = resource.SupportsOnReleaseImport;
definition.SupportsOnUpgrade = resource.SupportsOnUpgrade;
@ -82,7 +82,7 @@ namespace Readarr.Api.V1.Notifications
definition.IncludeHealthWarnings = resource.IncludeHealthWarnings;
definition.SupportsOnDownloadFailure = resource.SupportsOnDownloadFailure;
definition.SupportsOnImportFailure = resource.SupportsOnImportFailure;
definition.SupportsOnTrackRetag = resource.SupportsOnTrackRetag;
definition.SupportsOnBookRetag = resource.SupportsOnBookRetag;
return definition;
}

Loading…
Cancel
Save