2011-11-02 03:08:53 +00:00
|
|
|
|
using System;
|
|
|
|
|
using NLog;
|
2013-02-19 06:01:03 +00:00
|
|
|
|
using NzbDrone.Core.Tv;
|
2011-11-02 03:08:53 +00:00
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers.ExternalNotification
|
|
|
|
|
{
|
|
|
|
|
public class Growl : ExternalNotificationBase
|
|
|
|
|
{
|
|
|
|
|
private readonly GrowlProvider _growlProvider;
|
|
|
|
|
|
|
|
|
|
public Growl(ConfigProvider configProvider, GrowlProvider growlProvider)
|
|
|
|
|
: base(configProvider)
|
|
|
|
|
{
|
|
|
|
|
_growlProvider = growlProvider;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "Growl"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGrab(string message)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(_configProvider.GrowlNotifyOnGrab)
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Sending Notification to Growl");
|
|
|
|
|
const string title = "Episode Grabbed";
|
|
|
|
|
|
|
|
|
|
var growlHost = _configProvider.GrowlHost.Split(':');
|
|
|
|
|
var host = growlHost[0];
|
|
|
|
|
var port = Convert.ToInt32(growlHost[1]);
|
|
|
|
|
|
2012-02-07 08:12:37 +00:00
|
|
|
|
_growlProvider.SendNotification(title, message, "GRAB", host, port, _configProvider.GrowlPassword);
|
2011-11-02 03:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2011-11-08 20:12:54 +00:00
|
|
|
|
_logger.WarnException(ex.Message, ex);
|
2011-11-02 03:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnDownload(string message, Series series)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (_configProvider.GrowlNotifyOnDownload)
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Sending Notification to Growl");
|
|
|
|
|
const string title = "Episode Downloaded";
|
|
|
|
|
|
|
|
|
|
var growlHost = _configProvider.GrowlHost.Split(':');
|
|
|
|
|
var host = growlHost[0];
|
|
|
|
|
var port = Convert.ToInt32(growlHost[1]);
|
|
|
|
|
|
2012-02-07 08:12:37 +00:00
|
|
|
|
_growlProvider.SendNotification(title, message, "DOWNLOAD", host, port, _configProvider.GrowlPassword);
|
2011-11-02 03:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2011-11-08 20:12:54 +00:00
|
|
|
|
_logger.WarnException(ex.Message, ex);
|
2011-11-02 03:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnRename(string message, Series series)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2012-01-05 03:40:25 +00:00
|
|
|
|
|
|
|
|
|
public override void AfterRename(string message, Series series)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2011-11-02 03:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|