diff --git a/NzbDrone.Core/Providers/PlexProvider.cs b/NzbDrone.Core/Providers/PlexProvider.cs
index c08cdfb69..05106b7d1 100644
--- a/NzbDrone.Core/Providers/PlexProvider.cs
+++ b/NzbDrone.Core/Providers/PlexProvider.cs
@@ -93,5 +93,15 @@ namespace NzbDrone.Core.Providers
return _httpProvider.DownloadString(url);
}
+
+ public virtual void TestNotification(string hosts, string username, string password)
+ {
+ foreach (var host in hosts.Split(','))
+ {
+ logger.Trace("Sending Test Notifcation to XBMC Host: {0}", host);
+ var command = String.Format("ExecBuiltIn(Notification({0}, {1}))", "Test Notification", "Success! Notifications are setup correctly");
+ SendCommand(host.Trim(), command, _configProvider.PlexUsername, _configProvider.PlexPassword);
+ }
+ }
}
}
diff --git a/NzbDrone.Web/Controllers/CommandController.cs b/NzbDrone.Web/Controllers/CommandController.cs
index bf9a7ac18..bc1b0cf68 100644
--- a/NzbDrone.Web/Controllers/CommandController.cs
+++ b/NzbDrone.Web/Controllers/CommandController.cs
@@ -19,12 +19,13 @@ namespace NzbDrone.Web.Controllers
private readonly SeasonProvider _seasonProvider;
private readonly ProwlProvider _prowlProvider;
private readonly XbmcProvider _xbmcProvider;
+ private readonly PlexProvider _plexProvider;
public CommandController(JobProvider jobProvider, SabProvider sabProvider,
SmtpProvider smtpProvider, TwitterProvider twitterProvider,
EpisodeProvider episodeProvider, GrowlProvider growlProvider,
SeasonProvider seasonProvider, ProwlProvider prowlProvider,
- XbmcProvider xbmcProvider)
+ XbmcProvider xbmcProvider, PlexProvider plexProvider)
{
_jobProvider = jobProvider;
_sabProvider = sabProvider;
@@ -35,6 +36,7 @@ namespace NzbDrone.Web.Controllers
_seasonProvider = seasonProvider;
_prowlProvider = prowlProvider;
_xbmcProvider = xbmcProvider;
+ _plexProvider = plexProvider;
}
public JsonResult RssSync()
@@ -173,7 +175,7 @@ namespace NzbDrone.Web.Controllers
try
{
_xbmcProvider.TestNotification(hosts);
- return JsonNotificationResult.Info("Success!", "Test Notification Sent Successfully");
+ return JsonNotificationResult.Info("Success!", "Test Notification sent successfully");
}
catch(Exception)
{
@@ -195,5 +197,33 @@ namespace NzbDrone.Web.Controllers
return JsonNotificationResult.Oops("Failed to test JSON API, please review your settings.");
}
+
+ public JsonResult TestPlexNotification(string hosts, string username, string password)
+ {
+ try
+ {
+ _plexProvider.TestNotification(hosts, username, password);
+ return JsonNotificationResult.Info("Success!", "Test Notification sent successfully");
+ }
+ catch (Exception)
+ {
+ }
+
+ return JsonNotificationResult.Oops("Failed to send test notification, please review your settings.");
+ }
+
+ public JsonResult TestPlexServer(string host)
+ {
+ try
+ {
+ _plexProvider.GetSectionKeys(host);
+ return JsonNotificationResult.Info("Success!", "Successfully tested Server settings");
+ }
+ catch (Exception)
+ {
+ }
+
+ return JsonNotificationResult.Oops("Failed to connect to server, please review your settings.");
+ }
}
}
diff --git a/NzbDrone.Web/Scripts/NzbDrone/settings.js b/NzbDrone.Web/Scripts/NzbDrone/settings.js
index e5dca31c8..5791544bf 100644
--- a/NzbDrone.Web/Scripts/NzbDrone/settings.js
+++ b/NzbDrone.Web/Scripts/NzbDrone/settings.js
@@ -11,6 +11,8 @@ var testSabUrl = '../Command/TestSabnzbd';
var testEmailUrl = '../Command/TestEmail';
var testXbmcNotificationUrl = '../Command/TestXbmcNotification';
var testXbmcJsonApiUrl = '../Command/TestXbmcJsonApi';
+var testPlexNotificationUrl = '../Command/TestPlexNotification';
+var testPlexServerUrl = '../Command/TestPlexServer';
function createExamples() {
createSingleEpisodeExample();
@@ -250,4 +252,31 @@ $(document).on('click', '#xbmc-test-jsonapi', function () {
password: password
})
});
+});
+
+//Plex
+$(document).on('click', '#plex-test-notification', function () {
+ var hosts = $('#PlexsClientHosts').val();
+ var username = $('#PlexUsername').val();
+ var password = $('#PlexPassword').val();
+
+ $.ajax({
+ url: testPlexNotificationUrl,
+ data: jQuery.param({
+ hosts: hosts,
+ username: username,
+ password: password
+ })
+ });
+});
+
+$(document).on('click', '#plex-test-server', function () {
+ var host = $('#PlexServerHost').val();
+
+ $.ajax({
+ url: testPlexServerUrl,
+ data: jQuery.param({
+ host: host
+ })
+ });
});
\ No newline at end of file
diff --git a/NzbDrone.Web/Views/Settings/Plex.cshtml b/NzbDrone.Web/Views/Settings/Plex.cshtml
index 9b7d96359..14ffebfc1 100644
--- a/NzbDrone.Web/Views/Settings/Plex.cshtml
+++ b/NzbDrone.Web/Views/Settings/Plex.cshtml
@@ -47,4 +47,14 @@
@Html.DescriptionFor(m => m.PlexPassword)
@Html.TextBoxFor(m => m.PlexPassword, new { @class = "inputClass", type = "password" })
+
+
+
+
+
+
\ No newline at end of file