From 014c4b675fc95f1fd11b7f6a45ca0eff39cffb7c Mon Sep 17 00:00:00 2001 From: nothingmn Date: Thu, 7 Oct 2010 22:50:01 -0700 Subject: [PATCH] Play Pause and Stop all working --- NzbDrone.Web/Controllers/SeriesController.cs | 28 ++++++++++++++++++++ NzbDrone.Web/Views/Series/index.aspx | 24 +++++++++++++---- NzbDrone.Web/Views/Shared/Site.Master | 22 +++++++++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) 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
+
<% Html.Telerik().Menu().Name("telerikGrid").Items(items => { items.Add().Text("View Unmapped Folders").Action("Unmapped", "Series"); }) .Items(items => items.Add().Text("Sync With Disk").Action("Sync", "Series")) diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master index 9c7a57fcb..d96a220ac 100644 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ b/NzbDrone.Web/Views/Shared/Site.Master @@ -22,6 +22,28 @@ Released : 20100727 Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.sitefinity.css")).Render(); %> +