Added Media Disco Providers - these will be used to auto detect media providers on the LAN

This commit is contained in:
nothingmn 2010-10-07 21:34:32 -07:00
parent 92e0a8f1a4
commit 78dba9c668
5 changed files with 66 additions and 2 deletions

View File

@ -149,7 +149,9 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Providers\IMediaDiscoveryProvider.cs" />
<Compile Include="Providers\IMediaProvider.cs" /> <Compile Include="Providers\IMediaProvider.cs" />
<Compile Include="Providers\MediaDiscoveryProvider.cs" />
<Compile Include="Providers\XBMCMediaProvider.cs" /> <Compile Include="Providers\XBMCMediaProvider.cs" />
<Compile Include="SonicTrace.cs" /> <Compile Include="SonicTrace.cs" />
<Compile Include="Providers\ConfigProvider.cs" /> <Compile Include="Providers\ConfigProvider.cs" />

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
interface IMediaDiscoveryProvider
{
void Discover();
bool DiscoveredMedia { get; }
List<IMediaProvider> Providers { get; }
}
}

View File

@ -5,8 +5,8 @@ using System.Text;
namespace NzbDrone.Core.Providers namespace NzbDrone.Core.Providers
{ {
interface IMediaProvider public interface IMediaProvider
{ {
void Play(); void Play();
void Play(string Location); void Play(string Location);
void Play(string Location, bool AddToQueue); void Play(string Location, bool AddToQueue);

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Providers
{
public class MediaDiscoveryProvider : IMediaDiscoveryProvider
{
#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); }
}
private object _lock = new object();
public List<IMediaProvider> Providers
{
get {
lock (_lock)
{
List<IMediaProvider> list = new List<IMediaProvider>();
foreach (OpenSource.UPnP.IAVDevice device in OpenSource.UPnP.AudioVideoDevices.Instance.Devices)
{
OpenSource.XBMC.XBMCAVDevice xbmc = (device as OpenSource.XBMC.XBMCAVDevice);
if (xbmc != null)
{
XBMCMediaProvider newX = new XBMCMediaProvider(xbmc);
list.Add(newX);
}
}
return list;
}
}
}
#endregion
}
}

View File

@ -11,6 +11,8 @@
.Items(items => items.Add().Text("Sync With Disk").Action("Sync", "Series")) .Items(items => items.Add().Text("Sync With Disk").Action("Sync", "Series"))
.Render(); .Render();
%> %>
sss
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% <%