From 947d895fe8c1d5c6af43873af143a84d6d049c12 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 15 Feb 2016 00:47:23 -0500 Subject: [PATCH] stub out sat/ip discovery --- .../LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs | 62 ++++++++----------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs index 95c04d61f..08c42bb46 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/SatIpDiscovery.cs @@ -41,29 +41,21 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e) { - //string server = null; - //if (e.Headers.TryGetValue("SERVER", out server) && server.IndexOf("HDHomeRun", StringComparison.OrdinalIgnoreCase) != -1) - //{ - // string location; - // if (e.Headers.TryGetValue("Location", out location)) - // { - // //_logger.Debug("HdHomerun found at {0}", location); + string st = null; + if (e.Headers.TryGetValue("ST", out st) && string.Equals(st, "urn:ses-com:device:SatIPServer:1", StringComparison.OrdinalIgnoreCase)) + { + string location; + if (e.Headers.TryGetValue("Location", out location) && !string.IsNullOrWhiteSpace(location)) + { + _logger.Debug("SAT IP found at {0}", location); - // // Just get the beginning of the url - // Uri uri; - // if (Uri.TryCreate(location, UriKind.Absolute, out uri)) - // { - // var apiUrl = location.Replace(uri.LocalPath, String.Empty, StringComparison.OrdinalIgnoreCase) - // .TrimEnd('/'); - - // //_logger.Debug("HdHomerun api url: {0}", apiUrl); - // AddDevice(apiUrl); - // } - // } - //} + // Just get the beginning of the url + AddDevice(location); + } + } } - private async void AddDevice(string url) + private async void AddDevice(string location) { await _semaphore.WaitAsync().ConfigureAwait(false); @@ -71,24 +63,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp { var options = GetConfiguration(); - if (options.TunerHosts.Any(i => - string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && - UriEquals(i.Url, url))) - { - return; - } + //if (options.TunerHosts.Any(i => + // string.Equals(i.Type, SatIpHost.DeviceType, StringComparison.OrdinalIgnoreCase) && + // UriEquals(i.Url, url))) + //{ + // return; + //} - // Strip off the port - url = new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped).TrimEnd('/'); + //// Strip off the port + //url = new Uri(url).GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped).TrimEnd('/'); - await TestUrl(url).ConfigureAwait(false); - - await _liveTvManager.SaveTunerHost(new TunerHostInfo - { - Type = SatIpHost.DeviceType, - Url = url + //await TestUrl(url).ConfigureAwait(false); - }).ConfigureAwait(false); + //await _liveTvManager.SaveTunerHost(new TunerHostInfo + //{ + // Type = SatIpHost.DeviceType, + // Url = url + + //}).ConfigureAwait(false); } catch (Exception ex) {