mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-03 01:01:34 +02:00
Added Media Disco Providers - these will be used to auto detect media providers on the LAN
This commit is contained in:
46
NzbDrone.Core/Providers/MediaDiscoveryProvider.cs
Normal file
46
NzbDrone.Core/Providers/MediaDiscoveryProvider.cs
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user