Update SatIpDiscovery.cs

Expand and correcting the Reading of the DeviceDescription Capability Field 
now can you look for how many Tuners and wicht type ( DVBS DVBT DVBC ) it is
pull/1154/head
Kay Diefenthal 8 years ago committed by GitHub
parent 71b5433d99
commit 6aa4583081

@ -26,7 +26,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
private readonly IHttpClient _httpClient;
private readonly IJsonSerializer _json;
private int _tunerCountDVBS=0;
private int _tunerCountDVBC=0;
private int _tunerCountDVBT=0;
private bool _supportsDVBS=false;
private bool _supportsDVBC=false;
private bool _supportsDVBT=false;
public static SatIpDiscovery Current;
public SatIpDiscovery(IDeviceDiscovery deviceDiscovery, IServerConfigurationManager config, ILogger logger, ILiveTvManager liveTvManager, IHttpClient httpClient, IJsonSerializer json)
@ -167,7 +172,57 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
public void Dispose()
{
}
private void ReadCapability(string capability)
{
string[] cap = capability.Split('-');
switch (cap[0].ToLower())
{
case "dvbs":
case "dvbs2":
{
// Optional that you know what an device Supports can you add an flag
_supportsDVBS = true;
for (int i = 0; i < int.Parse(cap[1]); i++)
{
//ToDo Create Digital Recorder / Tuner Capture Instance here for each with index FE param in Sat>Ip Spec for direct communication with this instance
}
_tunerCountDVBS = int.Parse(cap[1]);
break;
}
case "dvbc":
case "dvbc2":
{
// Optional that you know what an device Supports can you add an flag
_supportsDVBC = true;
for (int i = 0; i < int.Parse(cap[1]); i++)
{
//ToDo Create Digital Recorder / Tuner Capture Instance here for each with index FE param in Sat>Ip Spec for direct communication with this instance
}
_tunerCountDVBC = int.Parse(cap[1]);
break;
}
case "dvbt":
case "dvbt2":
{
// Optional that you know what an device Supports can you add an flag
_supportsDVBT = true;
for (int i = 0; i < int.Parse(cap[1]); i++)
{
//ToDo Create Digital Recorder / Tuner Capture Instance here for each with index FE param in Sat>Ip Spec for direct communication with this instance
}
_tunerCountDVBT = int.Parse(cap[1]);
break;
}
}
}
public async Task<SatIpTunerHostInfo> GetInfo(string url, CancellationToken cancellationToken)
{
Uri locationUri = new Uri(url);
@ -227,7 +282,27 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
var presentationUrlElement = deviceElement.Element(n0 + "presentationURL");
if (presentationUrlElement != null) presentationurl = presentationUrlElement.Value;
var capabilitiesElement = deviceElement.Element(n1 + "X_SATIPCAP");
if (capabilitiesElement != null) capabilities = capabilitiesElement.Value;
if (capabilitiesElement != null)
{
_capabilities = capabilitiesElement.Value;
if (capabilitiesElement.Value.Contains(','))
{
string[] capabilities = capabilitiesElement.Value.Split(',');
foreach (var capability in capabilities)
{
ReadCapability(capability);
}
}
else
{
ReadCapability(capabilitiesElement.Value);
}
}
else
{
_supportsDVBS = true;
_tunerCountDVBS =1;
}
var m3uElement = deviceElement.Element(n1 + "X_SATIPM3U");
if (m3uElement != null) m3u = m3uElement.Value;
}

Loading…
Cancel
Save