Test buttons for XBMC

New: Added buttons to test XBMC configuration
This commit is contained in:
Mark McDowall
2012-10-21 20:44:16 -07:00
parent d070401f20
commit cacd86b4ef
4 changed files with 98 additions and 16 deletions

View File

@@ -31,6 +31,11 @@ namespace NzbDrone.Core.Providers
_eventClientProvider = eventClientProvider;
}
public XbmcProvider()
{
}
public virtual void Notify(string header, string message)
{
//Always use EventServer, until Json has real support for it
@@ -41,11 +46,6 @@ namespace NzbDrone.Core.Providers
}
}
public XbmcProvider()
{
}
public virtual void Update(Series series)
{
//Use Json for Eden/Nightly or depricated HTTP for 10.x (Dharma) to get the proper path
@@ -376,6 +376,26 @@ namespace NzbDrone.Core.Providers
return false;
}
public virtual void TestNotification(string hosts)
{
foreach (var host in hosts.Split(','))
{
Logger.Trace("Sending Test Notifcation to XBMC Host: {0}", host);
_eventClientProvider.SendNotification("Test Notification", "Success! Notifications are setup correctly", IconType.Jpeg, "NzbDrone.jpg", GetHostWithoutPort(host));
}
}
public virtual void TestJsonApi(string hosts, string username, string password)
{
foreach (var host in hosts.Split(','))
{
Logger.Trace("Sending Test Notifcation to XBMC Host: {0}", host);
var version = GetJsonVersion(host, username, password);
if (version == 0)
throw new Exception("Failed to get JSON version in test");
}
}
private string GetHostWithoutPort(string address)
{
return address.Split(':')[0];