Play Pause and Stop all working

pull/4/head
nothingmn 14 years ago
parent dfbf13b868
commit 014c4b675f

@ -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 = "<span class='MediaRenderer XBMC'><span class='Play'>Play</span><span class='Pause'>Pause</span><span class='Stop'>Stop</span></span>" }, 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

@ -5,10 +5,11 @@
<asp:Content ID="Content3" ContentPlaceHolderID="JavascriptContent" runat="server">
$(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
});
}
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<div id="Title">Series</div>
Series
</asp:Content>
<asp:Content ID="Menue" ContentPlaceHolderID="ActionMenue" runat="server">
<div id="Mediabox"></div>
<%
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"))

@ -22,6 +22,28 @@ Released : 20100727
Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.sitefinity.css")).Render();
%>
<link href="../../Content/style.css" rel="stylesheet" type="text/css" media="screen" />
<style>
.Mediabox
{
background:black;
}
.Play
{
cursor:pointer;
padding:5px;
}
.Pause
{
cursor:pointer;
padding:5px;
}
.Stop
{
cursor:pointer;
padding:5px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
<asp:ContentPlaceHolder ID="JavascriptContent" runat="server" />

Loading…
Cancel
Save