From 6aa45830814219801934a6aed18039484fe7a032 Mon Sep 17 00:00:00 2001 From: Kay Diefenthal Date: Sun, 28 Aug 2016 11:19:50 +0200 Subject: [PATCH] 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 --- .../LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs | 79 ++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index 9d5dba2823..1e44877572 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -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 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; }