diff --git a/NzbDrone.Core/Providers/ExternalNotification/Growl.cs b/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
index 5d7701a24..31d3e39b1 100644
--- a/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
+++ b/NzbDrone.Core/Providers/ExternalNotification/Growl.cs
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
var host = growlHost[0];
var port = Convert.ToInt32(growlHost[1]);
- _growlProvider.SendNotification(title, message, host, "GRAB", port, _configProvider.GrowlPassword);
+ _growlProvider.SendNotification(title, message, "GRAB", host, port, _configProvider.GrowlPassword);
}
}
@@ -56,7 +56,7 @@ namespace NzbDrone.Core.Providers.ExternalNotification
var host = growlHost[0];
var port = Convert.ToInt32(growlHost[1]);
- _growlProvider.SendNotification(title, message, host, "DOWNLOAD", port, _configProvider.GrowlPassword);
+ _growlProvider.SendNotification(title, message, "DOWNLOAD", host, port, _configProvider.GrowlPassword);
}
}
diff --git a/NzbDrone.Web/Controllers/CommandController.cs b/NzbDrone.Web/Controllers/CommandController.cs
index 08cdb3a14..6d72bb7fb 100644
--- a/NzbDrone.Web/Controllers/CommandController.cs
+++ b/NzbDrone.Web/Controllers/CommandController.cs
@@ -4,6 +4,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.DownloadClients;
using NzbDrone.Web.Filters;
using NzbDrone.Web.Models;
+using System;
namespace NzbDrone.Web.Controllers
{
@@ -14,16 +15,18 @@ namespace NzbDrone.Web.Controllers
private readonly SmtpProvider _smtpProvider;
private readonly TwitterProvider _twitterProvider;
private readonly EpisodeProvider _episodeProvider;
+ private readonly GrowlProvider _growlProvider;
public CommandController(JobProvider jobProvider, SabProvider sabProvider,
SmtpProvider smtpProvider, TwitterProvider twitterProvider,
- EpisodeProvider episodeProvider)
+ EpisodeProvider episodeProvider, GrowlProvider growlProvider)
{
_jobProvider = jobProvider;
_sabProvider = sabProvider;
_smtpProvider = smtpProvider;
_twitterProvider = twitterProvider;
_episodeProvider = episodeProvider;
+ _growlProvider = growlProvider;
}
public JsonResult RssSync()
@@ -93,6 +96,25 @@ namespace NzbDrone.Web.Controllers
}
+ public JsonResult RegisterGrowl(string host, string password)
+ {
+ try
+ {
+ var split = host.Split(':');
+ var hostname = split[0];
+ var port = Convert.ToInt32(split[1]);
+
+ _growlProvider.Register(hostname, port, password);
+ _growlProvider.TestNotification(hostname, port, password);
+
+ return JsonNotificationResult.Info("Good News!", "Registered and tested growl successfully");
+ }
+ catch(Exception ex)
+ {
+ return JsonNotificationResult.Opps("Couldn't register and test Growl");
+ }
+ }
+
[HttpPost]
public EmptyResult SaveSeasonIgnore(int seriesId, int seasonNumber, bool ignored)
{
diff --git a/NzbDrone.Web/Views/Settings/Growl.cshtml b/NzbDrone.Web/Views/Settings/Growl.cshtml
index be8ed02ac..dad9872cd 100644
--- a/NzbDrone.Web/Views/Settings/Growl.cshtml
+++ b/NzbDrone.Web/Views/Settings/Growl.cshtml
@@ -30,4 +30,9 @@
@Html.DescriptionFor(m => m.GrowlPassword)
@Html.TextBoxFor(m => m.GrowlPassword, new { @class = "inputClass", type = "password" })
+
+
+
\ No newline at end of file
diff --git a/NzbDrone.Web/Views/Settings/Notifications.cshtml b/NzbDrone.Web/Views/Settings/Notifications.cshtml
index 5578cbb0d..b86ea921f 100644
--- a/NzbDrone.Web/Views/Settings/Notifications.cshtml
+++ b/NzbDrone.Web/Views/Settings/Notifications.cshtml
@@ -123,5 +123,27 @@
return false;
}
+
+ //Growl
+ function registerGrowl() {
+ //Get the variables
+ var host = $('#GrowlHost').val();
+ var password = $('#GrowlPassword').val();
+
+ //Send the data!
+ $.ajax({
+ type: "POST",
+ url: '../Command/RegisterGrowl',
+ data: jQuery.param({
+ host: host,
+ password: password
+ }),
+ error: function (req, status, error) {
+ alert("Sorry! We could send a test email at this time. " + error);
+ }
+ });
+
+ return false;
+ }
}