ExternalNotificationProvider complete, XBMC only for now.
This commit is contained in:
parent
0cb20b0092
commit
e166cb1b2d
|
@ -12,13 +12,15 @@ namespace NzbDrone.Core.Providers
|
||||||
public class ExternalNotificationProvider : IExtenalNotificationProvider
|
public class ExternalNotificationProvider : IExtenalNotificationProvider
|
||||||
{
|
{
|
||||||
private readonly IConfigProvider _configProvider;
|
private readonly IConfigProvider _configProvider;
|
||||||
|
private readonly IXbmcProvider _xbmcProvider;
|
||||||
|
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
public ExternalNotificationProvider(IConfigProvider configProvider)
|
public ExternalNotificationProvider(IConfigProvider configProvider, IXbmcProvider xbmcProvider)
|
||||||
{
|
{
|
||||||
_configProvider = configProvider;
|
_configProvider = configProvider;
|
||||||
|
_xbmcProvider = xbmcProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IExternalNotificationProvider Members
|
#region IExternalNotificationProvider Members
|
||||||
|
@ -31,7 +33,7 @@ namespace NzbDrone.Core.Providers
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Notifcation to XBMC");
|
Logger.Trace("Sending Notifcation to XBMC");
|
||||||
|
_xbmcProvider.Notify(header, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Logger.Trace("XBMC NotifyOnGrab is not enabled");
|
Logger.Trace("XBMC NotifyOnGrab is not enabled");
|
||||||
|
@ -50,20 +52,19 @@ namespace NzbDrone.Core.Providers
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Notifcation to XBMC");
|
Logger.Trace("Sending Notifcation to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Notify(header, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Update Request to XBMC");
|
Logger.Trace("Sending Update Request to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Update(erm.EpisodeFile.SeriesId);
|
||||||
//Send SeriesID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Clean DB Request to XBMC");
|
Logger.Trace("Sending Clean DB Request to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,20 +82,19 @@ namespace NzbDrone.Core.Providers
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Notifcation to XBMC");
|
Logger.Trace("Sending Notifcation to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Notify(header, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Update Request to XBMC");
|
Logger.Trace("Sending Update Request to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Update(erm.EpisodeFile.SeriesId);
|
||||||
//Send SeriesID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)))
|
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending Clean DB Request to XBMC");
|
Logger.Trace("Sending Clean DB Request to XBMC");
|
||||||
//Send to XBMC
|
_xbmcProvider.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ namespace NzbDrone.Core.Providers
|
||||||
foreach (var host in _configProvider.GetValue("XbmcHosts", "localhost:80", true).Split(','))
|
foreach (var host in _configProvider.GetValue("XbmcHosts", "localhost:80", true).Split(','))
|
||||||
{
|
{
|
||||||
Logger.Trace("Sending DB Clean Request to XBMC Host: {0}", host);
|
Logger.Trace("Sending DB Clean Request to XBMC Host: {0}", host);
|
||||||
|
|
||||||
var command = String.Format("ExecBuiltIn(CleanLibrary(database) )");
|
var command = String.Format("ExecBuiltIn(CleanLibrary(database) )");
|
||||||
SendCommand(host, command);
|
SendCommand(host, command);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue