Fix: Growl will now work for notifying on grab/download.

Growl must be registered before notifications will work.
pull/4/head
Mark McDowall 13 years ago
parent 04fdb130b8
commit 7ae751371d

@ -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);
}
}

@ -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)
{

@ -30,4 +30,9 @@
<span class="small">@Html.DescriptionFor(m => m.GrowlPassword)</span>
</label>
@Html.TextBoxFor(m => m.GrowlPassword, new { @class = "inputClass", type = "password" })
<label class="labelClass">Register & Test
<span class="small">Register NzbDrone in Growl, must be done before notifications will work</span>
</label>
<input type="button" onclick="registerGrowl();" value="Register & Test" class="inputClass"/>
</div>

@ -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;
}
</script>
}

Loading…
Cancel
Save