diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs
index 479647290..109e46fe4 100644
--- a/NzbDrone.Web/Controllers/SeriesController.cs
+++ b/NzbDrone.Web/Controllers/SeriesController.cs
@@ -56,6 +56,34 @@ namespace NzbDrone.Web.Controllers
return Json(new { Discovered = disco.DiscoveredMedia }, JsonRequestBehavior.AllowGet);
}
+ public JsonResult LightUpMedia()
+ {
+ Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
+ IMediaProvider p = disco.Providers[0];
+ return Json(new { ID = 0, HTML = "PlayPauseStop" }, JsonRequestBehavior.AllowGet);
+ }
+ public JsonResult ControlMedia()
+ {
+ Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
+ IMediaProvider p = disco.Providers[0];
+ string action = Request["Action"];
+ switch (action)
+ {
+ case "Play":
+ p.Play();
+ break;
+ case "Pause":
+ p.Pause();
+ break;
+ case "Stop":
+ p.Stop();
+ break;
+ default:
+ break;
+ }
+ return Json(new { Success=true}, JsonRequestBehavior.AllowGet);
+ }
+
//
// GET: /Series/Details/5
diff --git a/NzbDrone.Web/Views/Series/index.aspx b/NzbDrone.Web/Views/Series/index.aspx
index de18a7e5c..1d9560e0e 100644
--- a/NzbDrone.Web/Views/Series/index.aspx
+++ b/NzbDrone.Web/Views/Series/index.aspx
@@ -5,10 +5,11 @@
$(document).ready(function () {
- setTimeout(MediaDetect(), 5000);
- $("#Title").bind("click", MediaDetect);
+ $("#Mediabox").bind("click", MediaBoxClick);
+ setTimeout('MediaDetect();', 5000);
});
var Discovered = false;
+
function MediaDetect() {
$.ajax({
url: 'Series/MediaDetect',
@@ -19,21 +20,34 @@
function MediaDetectCallback(data) {
Discovered=data.Discovered;
if(!Discovered)
- setTimeout(MediaDetect(), 10000);
+ setTimeout('MediaDetect();', 10000);
else
LightUpMedia(data);
}
function LightUpMedia(data) {
-
+ $.ajax({
+ url: 'Series/LightUpMedia',
+ success: LightUpMediaSuccess
+ });
+ }
+ function LightUpMediaSuccess(data) {
+ $("#Mediabox").html(data.HTML);
+ }
+ function MediaBoxClick(args) {
+ $.ajax({
+ url: 'Series/ControlMedia',
+ data: "Action=" + args.target.className
+ });
}
- Series
+ Series