Updated UPnP so it does disco async, updated DiscoProviders to handle that approriately, Added JsonAction result with JS Ajax call for client side detection, on a timer for media controllers

pull/6/head
nothingmn 14 years ago
parent 78dba9c668
commit dfbf13b868

Binary file not shown.

@ -144,9 +144,7 @@
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
<Reference Include="TvdbLib, Version=0.8.8.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="UPnP">
<HintPath>Libraries\UPnP.dll</HintPath>
</Reference>
<Reference Include="UPnP, Version=1.0.3932.37442, Culture=neutral, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="Providers\IMediaDiscoveryProvider.cs" />
@ -225,6 +223,7 @@
<Content Include="Libraries\TvdbLib.dll" />
<Content Include="Libraries\TvdbLib.pdb" />
<Content Include="Libraries\TvdbLib.XML" />
<Content Include="Libraries\UPnP.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

@ -5,9 +5,8 @@ using System.Text;
namespace NzbDrone.Core.Providers
{
interface IMediaDiscoveryProvider
public interface IMediaDiscoveryProvider
{
void Discover();
bool DiscoveredMedia { get; }
List<IMediaProvider> Providers { get; }
}

@ -9,12 +9,6 @@ namespace NzbDrone.Core.Providers
{
#region IMediaDiscoveryProvider Members
public void Discover()
{
//calling the static instance will kick off the discovery process
OpenSource.UPnP.AudioVideoDevices instance = OpenSource.UPnP.AudioVideoDevices.Instance;
}
public bool DiscoveredMedia
{
get { return (OpenSource.UPnP.AudioVideoDevices.Instance.Devices.Count > 0); }

@ -50,6 +50,12 @@ namespace NzbDrone.Web.Controllers
});
}
public JsonResult MediaDetect()
{
Core.Providers.IMediaDiscoveryProvider disco = new Core.Providers.MediaDiscoveryProvider();
return Json(new { Discovered = disco.DiscoveredMedia }, JsonRequestBehavior.AllowGet);
}
//
// GET: /Series/Details/5

@ -2,8 +2,36 @@
<%@ Import Namespace="Telerik.Web.Mvc.UI" %>
<%@ Import Namespace="NzbDrone.Core.Repository" %>
<asp:Content ID="Content3" ContentPlaceHolderID="JavascriptContent" runat="server">
$(document).ready(function () {
setTimeout(MediaDetect(), 5000);
$("#Title").bind("click", MediaDetect);
});
var Discovered = false;
function MediaDetect() {
$.ajax({
url: 'Series/MediaDetect',
success: MediaDetectCallback
});
}
function MediaDetectCallback(data) {
Discovered=data.Discovered;
if(!Discovered)
setTimeout(MediaDetect(), 10000);
else
LightUpMedia(data);
}
function LightUpMedia(data) {
}
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Series
<div id="Title">Series</div>
</asp:Content>
<asp:Content ID="Menue" ContentPlaceHolderID="ActionMenue" runat="server">
<%
@ -11,8 +39,6 @@
.Items(items => items.Add().Text("Sync With Disk").Action("Sync", "Series"))
.Render();
%>
sss
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%

@ -2,8 +2,7 @@
<%@ Import Namespace="Helpers" %>
<%@ Import Namespace="Telerik.Web.Mvc.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
Design by Free CSS Templates
@ -23,6 +22,11 @@ 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" />
<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" />
</script>
</head>
<body>
<div id="header">

Loading…
Cancel
Save