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

pull/3113/head
nothingmn 14 years ago
parent 92e0a8f1a4
commit 78dba9c668

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

@ -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; }
}
}

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

@ -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
}
}

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

Loading…
Cancel
Save