diff --git a/NzbDrone.Api/Notifications/NotificationModule.cs b/NzbDrone.Api/Notifications/NotificationModule.cs index fb667a38a..da14fbedc 100644 --- a/NzbDrone.Api/Notifications/NotificationModule.cs +++ b/NzbDrone.Api/Notifications/NotificationModule.cs @@ -34,6 +34,7 @@ namespace NzbDrone.Api.Notifications var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); + notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); } diff --git a/NzbDrone.Api/Notifications/NotificationResource.cs b/NzbDrone.Api/Notifications/NotificationResource.cs index 4b743dd5d..2d1776040 100644 --- a/NzbDrone.Api/Notifications/NotificationResource.cs +++ b/NzbDrone.Api/Notifications/NotificationResource.cs @@ -12,5 +12,6 @@ namespace NzbDrone.Api.Notifications public Boolean OnDownload { get; set; } public List Fields { get; set; } public String Implementation { get; set; } + public String Command { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs b/NzbDrone.Api/Notifications/NotificationSchemaModule.cs index 52a9dfa00..229d69e1a 100644 --- a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs +++ b/NzbDrone.Api/Notifications/NotificationSchemaModule.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using NzbDrone.Api.ClientSchema; using NzbDrone.Common.Reflection; using NzbDrone.Core.Annotations; @@ -21,8 +22,6 @@ namespace NzbDrone.Api.Notifications private List GetSchema() { - //Need to get all the possible Notification's same as we would for settiings (but keep them empty) - var notifications = _notificationService.Schema(); var result = new List(notifications.Count); @@ -32,6 +31,7 @@ namespace NzbDrone.Api.Notifications var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); + notificationResource.Command = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); } diff --git a/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs b/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs index 4f1761477..133d7d54a 100644 --- a/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs +++ b/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs @@ -107,11 +107,16 @@ namespace NzbDrone.Core.Notifications.Xbmc Username = message.Username, Password = message.Password }; - + Logger.Trace("Determining version of XBMC Host: {0}", settings.Address); var version = GetJsonVersion(settings); Logger.Trace("Version is: {0}", version); + if (version == new XbmcVersion(0)) + { + throw new InvalidXbmcVersionException("Verion received from XBMC is invalid, please correct your settings."); + } + Notify(settings, "Test Notification", "Success! XBMC has been successfully configured!"); } } diff --git a/UI/Commands/CommandController.js b/UI/Commands/CommandController.js index 0bd4763d3..535fa3c28 100644 --- a/UI/Commands/CommandController.js +++ b/UI/Commands/CommandController.js @@ -1,11 +1,17 @@ "use strict"; define(['app'], function () { - NzbDrone.Commands.Execute = function (name) { + NzbDrone.Commands.Execute = function (name, properties) { + var data = { command: name }; + + if (properties !== undefined) { + $.extend(data, properties); + } + return $.ajax({ type: 'POST', url : NzbDrone.Constants.ApiRoot + '/command', - data: JSON.stringify({command: name}) + data: JSON.stringify(data) }); }; }); \ No newline at end of file diff --git a/UI/Settings/Notifications/EditTemplate.html b/UI/Settings/Notifications/EditTemplate.html index f4ab178be..595637c29 100644 --- a/UI/Settings/Notifications/EditTemplate.html +++ b/UI/Settings/Notifications/EditTemplate.html @@ -57,6 +57,13 @@ {{formBuilder}} + +
+ +
+ +
+