From 34c5aab607fb5d9240a6286747a70a0b448e019b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 9 Apr 2017 21:51:36 -0400 Subject: [PATCH] 3.2.12.2 --- .../BaseApplicationHost.cs | 5 ++++ Emby.Server.Core/ApplicationHost.cs | 6 ++--- .../Updates/InstallationManager.cs | 11 ++++++-- MediaBrowser.Common/IApplicationHost.cs | 2 ++ MediaBrowser.Server.Mono/MonoAppHost.cs | 7 +++++ .../MediaBrowser.Server.Startup.Common.csproj | 1 + .../UpdateLevelHelper.cs | 27 +++++++++++++++++++ .../WindowsAppHost.cs | 7 +++++ SharedVersion.cs | 2 +- 9 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 MediaBrowser.Server.Startup.Common/UpdateLevelHelper.cs diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 13bb85087..d3d8672be 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -179,6 +179,11 @@ namespace Emby.Common.Implementations } } + public virtual PackageVersionClass SystemUpdateLevel + { + get { return PackageVersionClass.Release; } + } + public virtual string OperatingSystemDisplayName { get { return EnvironmentInfo.OperatingSystemName; } diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index 50c572b8c..90fa924e6 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -1366,7 +1366,7 @@ namespace Emby.Server.Core SupportsLibraryMonitor = true, EncoderLocationType = MediaEncoder.EncoderLocationType, SystemArchitecture = EnvironmentInfo.SystemArchitecture, - SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel, + SystemUpdateLevel = SystemUpdateLevel, PackageName = StartupOptions.GetOption("-package") }; } @@ -1591,7 +1591,7 @@ namespace Emby.Server.Core } catch (NotImplementedException) { - + } catch (Exception ex) { @@ -1632,7 +1632,7 @@ namespace Emby.Server.Core public override async Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) { var cacheLength = TimeSpan.FromHours(3); - var updateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel; + var updateLevel = SystemUpdateLevel; if (updateLevel == PackageVersionClass.Beta) { diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index a13dd0569..840c7ce0d 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -270,9 +270,14 @@ namespace Emby.Server.Implementations.Updates } } + private PackageVersionClass GetSystemUpdateLevel() + { + return _applicationHost.SystemUpdateLevel; + } + private TimeSpan GetCacheLength() { - switch (_config.CommonConfiguration.SystemUpdateLevel) + switch (GetSystemUpdateLevel()) { case PackageVersionClass.Beta: return TimeSpan.FromMinutes(30); @@ -424,10 +429,12 @@ namespace Emby.Server.Implementations.Updates .ToList(); } + var systemUpdateLevel = GetSystemUpdateLevel(); + // Figure out what needs to be installed var packages = plugins.Select(p => { - var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, _config.CommonConfiguration.SystemUpdateLevel); + var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, systemUpdateLevel); return latestPluginInfo != null && GetPackageVersion(latestPluginInfo) > p.Version ? latestPluginInfo : null; diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index 35d6dca3d..2b5ae6799 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -157,5 +157,7 @@ namespace MediaBrowser.Common /// The type. /// System.Object. object CreateInstance(Type type); + + PackageVersionClass SystemUpdateLevel { get; } } } diff --git a/MediaBrowser.Server.Mono/MonoAppHost.cs b/MediaBrowser.Server.Mono/MonoAppHost.cs index 811e0f444..54fd45019 100644 --- a/MediaBrowser.Server.Mono/MonoAppHost.cs +++ b/MediaBrowser.Server.Mono/MonoAppHost.cs @@ -12,6 +12,8 @@ using MediaBrowser.IsoMounter; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.System; +using MediaBrowser.Model.Updates; +using MediaBrowser.Server.Startup.Common; namespace MediaBrowser.Server.Mono { @@ -40,6 +42,11 @@ namespace MediaBrowser.Server.Mono return new SyncManager(); } + public override PackageVersionClass SystemUpdateLevel + { + get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); } + } + protected override void RestartInternal() { MainClass.Restart(StartupOptions); diff --git a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj index 97d04cff4..5eb492166 100644 --- a/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj +++ b/MediaBrowser.Server.Startup.Common/MediaBrowser.Server.Startup.Common.csproj @@ -77,6 +77,7 @@ + diff --git a/MediaBrowser.Server.Startup.Common/UpdateLevelHelper.cs b/MediaBrowser.Server.Startup.Common/UpdateLevelHelper.cs new file mode 100644 index 000000000..7f3e27d91 --- /dev/null +++ b/MediaBrowser.Server.Startup.Common/UpdateLevelHelper.cs @@ -0,0 +1,27 @@ +using System; +using System.Configuration; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Updates; + +namespace MediaBrowser.Server.Startup.Common +{ + public static class UpdateLevelHelper + { + public static PackageVersionClass GetSystemUpdateLevel(IConfigurationManager config) + { + return config.CommonConfiguration.SystemUpdateLevel; + //var configuredValue = ConfigurationManager.AppSettings["SystemUpdateLevel"]; + + //if (string.Equals(configuredValue, "Beta", StringComparison.OrdinalIgnoreCase)) + //{ + // return PackageVersionClass.Beta; + //} + //if (string.Equals(configuredValue, "Dev", StringComparison.OrdinalIgnoreCase)) + //{ + // return PackageVersionClass.Dev; + //} + + //return PackageVersionClass.Release; + } + } +} diff --git a/MediaBrowser.ServerApplication/WindowsAppHost.cs b/MediaBrowser.ServerApplication/WindowsAppHost.cs index 8f1a88a74..cd293fddf 100644 --- a/MediaBrowser.ServerApplication/WindowsAppHost.cs +++ b/MediaBrowser.ServerApplication/WindowsAppHost.cs @@ -17,6 +17,8 @@ using MediaBrowser.Controller.Sync; using MediaBrowser.Model.IO; using MediaBrowser.Model.Logging; using MediaBrowser.Model.System; +using MediaBrowser.Model.Updates; +using MediaBrowser.Server.Startup.Common; using MediaBrowser.ServerApplication.Native; namespace MediaBrowser.ServerApplication @@ -53,6 +55,11 @@ namespace MediaBrowser.ServerApplication LoopUtil.Run(appName); } + public override PackageVersionClass SystemUpdateLevel + { + get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); } + } + protected override List GetAssembliesWithPartsInternal() { var list = new List(); diff --git a/SharedVersion.cs b/SharedVersion.cs index 3daabe507..44836be44 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.12.1")] +[assembly: AssemblyVersion("3.2.12.2")]