|
|
|
@ -1,23 +1,17 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Helpers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers.ExternalNotification
|
|
|
|
|
{
|
|
|
|
|
public class XbmcNotificationProvider : ExternalNotificationProviderBase
|
|
|
|
|
{
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
private readonly XbmcProvider _xbmcProvider;
|
|
|
|
|
|
|
|
|
|
public XbmcNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider,
|
|
|
|
|
ExternalNotificationProvider externalNotificationProvider) : base(configProvider, externalNotificationProvider)
|
|
|
|
|
ExternalNotificationProvider externalNotificationProvider)
|
|
|
|
|
: base(configProvider, externalNotificationProvider)
|
|
|
|
|
{
|
|
|
|
|
_xbmcProvider = xbmcProvider;
|
|
|
|
|
_logger = LogManager.GetLogger(GetType().ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string Name
|
|
|
|
@ -27,13 +21,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|
|
|
|
|
|
|
|
|
public override void OnGrab(string message)
|
|
|
|
|
{
|
|
|
|
|
var header = "NzbDrone [TV] - Grabbed";
|
|
|
|
|
const string header = "NzbDrone [TV] - Grabbed";
|
|
|
|
|
|
|
|
|
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Sending Notifcation to XBMC");
|
|
|
|
|
_logger.Trace("Sending Notification to XBMC");
|
|
|
|
|
_xbmcProvider.Notify(header, message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -45,13 +39,13 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|
|
|
|
|
|
|
|
|
public override void OnDownload(string message, int seriesId)
|
|
|
|
|
{
|
|
|
|
|
var header = "NzbDrone [TV] - Downloaded";
|
|
|
|
|
const string header = "NzbDrone [TV] - Downloaded";
|
|
|
|
|
|
|
|
|
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
|
|
|
|
|
{
|
|
|
|
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Sending Notifcation to XBMC");
|
|
|
|
|
_logger.Trace("Sending Notification to XBMC");
|
|
|
|
|
_xbmcProvider.Notify(header, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -73,11 +67,11 @@ namespace NzbDrone.Core.Providers.ExternalNotification
|
|
|
|
|
|
|
|
|
|
public override void OnRename(string message, int seriesId)
|
|
|
|
|
{
|
|
|
|
|
var header = "NzbDrone [TV] - Renamed";
|
|
|
|
|
const string header = "NzbDrone [TV] - Renamed";
|
|
|
|
|
|
|
|
|
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
|
|
|
|
|
{
|
|
|
|
|
_logger.Trace("Sending Notifcation to XBMC");
|
|
|
|
|
_logger.Trace("Sending Notification to XBMC");
|
|
|
|
|
_xbmcProvider.Notify(header, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|