diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-25 13:52:36 -0400 |
| commit | d9108f69f35080acb5ebefaefcd469595529afa2 (patch) | |
| tree | 3f04e719877b9cdec9529ca34406b753f6492abc /MediaBrowser.Server.Startup.Common | |
| parent | d6832e7a41c2a24f7dd998284e8e4f6eacf1d188 (diff) | |
| parent | 72fe76ab1008f0bd38157cc37cde45797b5f6417 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
4 files changed, 65 insertions, 5 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index a54380850..269c30669 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -97,6 +97,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Net.Sockets; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -322,7 +323,7 @@ namespace MediaBrowser.Server.Startup.Common { TaskManager.SuspendTriggers = true; } - + await base.RunStartupTasks().ConfigureAwait(false); Logger.Info("ServerId: {0}", SystemId); @@ -374,6 +375,7 @@ namespace MediaBrowser.Server.Startup.Common var migrations = new List<IVersionMigration> { new OmdbEpisodeProviderMigration(ServerConfigurationManager), + new MovieDbEpisodeProviderMigration(ServerConfigurationManager), new DbMigration(ServerConfigurationManager, TaskManager) }; @@ -1133,7 +1135,7 @@ namespace MediaBrowser.Server.Startup.Common if (address != null) { - return GetLocalApiUrl(address.ToString()); + return GetLocalApiUrl(address); } return null; @@ -1147,6 +1149,16 @@ namespace MediaBrowser.Server.Startup.Common } } + public string GetLocalApiUrl(IPAddress ipAddress) + { + if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6) + { + return GetLocalApiUrl("[" + ipAddress + "]"); + } + + return GetLocalApiUrl(ipAddress.ToString()); + } + public string GetLocalApiUrl(string host) { return string.Format("http://{0}:{1}", @@ -1179,7 +1191,7 @@ namespace MediaBrowser.Server.Startup.Common return true; } - var apiUrl = GetLocalApiUrl(address.ToString()); + var apiUrl = GetLocalApiUrl(address); apiUrl += "/system/ping"; if ((DateTime.UtcNow - _lastAddressCacheClear).TotalMinutes >= 5) diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index dbbd054a8..80ce88fa3 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -33,7 +33,7 @@ <ItemGroup> <Reference Include="CommonIO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\CommonIO.1.0.0.8\lib\net45\CommonIO.dll</HintPath> + <HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath> </Reference> <Reference Include="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -73,6 +73,7 @@ <Compile Include="MbLinkShortcutHandler.cs" /> <Compile Include="Migrations\IVersionMigration.cs" /> <Compile Include="Migrations\DbMigration.cs" /> + <Compile Include="Migrations\MovieDbEpisodeProviderMigration.cs" /> <Compile Include="Migrations\OmdbEpisodeProviderMigration.cs" /> <Compile Include="Migrations\RenameXmlOptions.cs" /> <Compile Include="NativeEnvironment.cs" /> diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs new file mode 100644 index 000000000..c2ed0c981 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/Migrations/MovieDbEpisodeProviderMigration.cs @@ -0,0 +1,47 @@ +using MediaBrowser.Controller.Configuration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MediaBrowser.Server.Startup.Common.Migrations +{ + class MovieDbEpisodeProviderMigration : IVersionMigration + { + private readonly IServerConfigurationManager _config; + private const string _providerName = "TheMovieDb"; + + public MovieDbEpisodeProviderMigration(IServerConfigurationManager config) + { + _config = config; + } + + public void Run() + { + var migrationKey = this.GetType().FullName; + var migrationKeyList = _config.Configuration.Migrations.ToList(); + + if (!migrationKeyList.Contains(migrationKey)) + { + foreach (var metaDataOption in _config.Configuration.MetadataOptions) + { + if (metaDataOption.ItemType == "Episode") + { + var disabledFetchers = metaDataOption.DisabledMetadataFetchers.ToList(); + if (!disabledFetchers.Contains(_providerName)) + { + disabledFetchers.Add(_providerName); + metaDataOption.DisabledMetadataFetchers = disabledFetchers.ToArray(); + } + } + } + + migrationKeyList.Add(migrationKey); + _config.Configuration.Migrations = migrationKeyList.ToArray(); + _config.SaveConfiguration(); + } + + } + } +} diff --git a/MediaBrowser.Server.Startup.Common/packages.config b/MediaBrowser.Server.Startup.Common/packages.config index 99bcc7f4b..238025a78 100644 --- a/MediaBrowser.Server.Startup.Common/packages.config +++ b/MediaBrowser.Server.Startup.Common/packages.config @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="CommonIO" version="1.0.0.8" targetFramework="net45" /> + <package id="CommonIO" version="1.0.0.9" targetFramework="net45" /> <package id="Mono.Posix" version="4.0.0.0" targetFramework="net45" /> <package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" /> </packages>
\ No newline at end of file |
