diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-19 18:28:35 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-08-19 18:28:35 -0400 |
| commit | fda7ff5bf2795cb03ee2a5355c8003da31bf24f9 (patch) | |
| tree | 52e7989d001e42b2c14fd50532b9c964f91242af /MediaBrowser.ServerApplication | |
| parent | b48d15296c1708545f358dc0ccbc48fea9b2cf00 (diff) | |
chromecast updates
Diffstat (limited to 'MediaBrowser.ServerApplication')
4 files changed, 41 insertions, 7 deletions
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 39a7981b2..35ee580b5 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -554,9 +554,9 @@ namespace MediaBrowser.ServerApplication SetKernelProperties(); } - protected override INetworkManager CreateNetworkManager() + protected override INetworkManager CreateNetworkManager(ILogger logger) { - return new NetworkManager(); + return new NetworkManager(logger); } protected override IFileSystem CreateFileSystemManager() @@ -958,10 +958,39 @@ namespace MediaBrowser.ServerApplication SupportsAutoRunAtStartup = SupportsAutoRunAtStartup, TranscodingTempPath = ApplicationPaths.TranscodingTempPath, IsRunningAsService = IsRunningAsService, - ServerName = FriendlyName + ServerName = FriendlyName, + LocalAddress = GetLocalIpAddress() }; } + /// <summary> + /// Gets the local ip address. + /// </summary> + /// <returns>System.String.</returns> + private string GetLocalIpAddress() + { + var localAddresses = NetworkManager.GetLocalIpAddresses().ToList(); + + // Cross-check the local ip addresses with addresses that have been received on with the http server + var matchedAddress = HttpServer.LocalEndPoints + .ToList() + .Select(i => i.Split(':').FirstOrDefault()) + .Where(i => !string.IsNullOrEmpty(i)) + .FirstOrDefault(i => localAddresses.Contains(i, StringComparer.OrdinalIgnoreCase)); + + // Return the first matched address, if found, or the first known local address + var address = matchedAddress ?? localAddresses.FirstOrDefault(); + + if (!string.IsNullOrWhiteSpace(address)) + { + address = string.Format("http://{0}:{1}", + address, + ServerConfigurationManager.Configuration.HttpServerPortNumber.ToString(CultureInfo.InvariantCulture)); + } + + return address; + } + public string FriendlyName { get diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 0e4d95c31..ce17f9e8e 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -61,14 +61,14 @@ </PropertyGroup> <ItemGroup> <Reference Include="MediaBrowser.IsoMounter"> - <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.68\lib\net45\MediaBrowser.IsoMounter.dll</HintPath> + <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\MediaBrowser.IsoMounter.dll</HintPath> </Reference> <Reference Include="NLog, Version=3.1.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\NLog.3.1.0.0\lib\net45\NLog.dll</HintPath> </Reference> <Reference Include="pfmclrapi"> - <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.68\lib\net45\pfmclrapi.dll</HintPath> + <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.69\lib\net45\pfmclrapi.dll</HintPath> </Reference> <Reference Include="ServiceStack.Interfaces"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath> diff --git a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs index 4d4d5a451..fc4d26363 100644 --- a/MediaBrowser.ServerApplication/Networking/NetworkManager.cs +++ b/MediaBrowser.ServerApplication/Networking/NetworkManager.cs @@ -1,13 +1,13 @@ using MediaBrowser.Common.Implementations.Networking; using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Logging; using MediaBrowser.Model.Net; using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Net; using System.Runtime.InteropServices; namespace MediaBrowser.ServerApplication.Networking @@ -17,6 +17,11 @@ namespace MediaBrowser.ServerApplication.Networking /// </summary> public class NetworkManager : BaseNetworkManager, INetworkManager { + public NetworkManager(ILogger logger) + : base(logger) + { + } + /// <summary> /// Gets the network shares. /// </summary> diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index 267084c52..8de487fb5 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="MediaBrowser.IsoMounting" version="3.0.68" targetFramework="net45" /> + <package id="MediaBrowser.IsoMounting" version="3.0.69" targetFramework="net45" /> <package id="NLog" version="3.1.0.0" targetFramework="net45" /> </packages>
\ No newline at end of file |
