This commit is contained in:
Luke Pulverenti 2017-04-09 21:51:36 -04:00
parent e56faea17a
commit 34c5aab607
9 changed files with 62 additions and 6 deletions

View File

@ -179,6 +179,11 @@ namespace Emby.Common.Implementations
} }
} }
public virtual PackageVersionClass SystemUpdateLevel
{
get { return PackageVersionClass.Release; }
}
public virtual string OperatingSystemDisplayName public virtual string OperatingSystemDisplayName
{ {
get { return EnvironmentInfo.OperatingSystemName; } get { return EnvironmentInfo.OperatingSystemName; }

View File

@ -1366,7 +1366,7 @@ namespace Emby.Server.Core
SupportsLibraryMonitor = true, SupportsLibraryMonitor = true,
EncoderLocationType = MediaEncoder.EncoderLocationType, EncoderLocationType = MediaEncoder.EncoderLocationType,
SystemArchitecture = EnvironmentInfo.SystemArchitecture, SystemArchitecture = EnvironmentInfo.SystemArchitecture,
SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel, SystemUpdateLevel = SystemUpdateLevel,
PackageName = StartupOptions.GetOption("-package") PackageName = StartupOptions.GetOption("-package")
}; };
} }
@ -1632,7 +1632,7 @@ namespace Emby.Server.Core
public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress) public override async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{ {
var cacheLength = TimeSpan.FromHours(3); var cacheLength = TimeSpan.FromHours(3);
var updateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel; var updateLevel = SystemUpdateLevel;
if (updateLevel == PackageVersionClass.Beta) if (updateLevel == PackageVersionClass.Beta)
{ {

View File

@ -270,9 +270,14 @@ namespace Emby.Server.Implementations.Updates
} }
} }
private PackageVersionClass GetSystemUpdateLevel()
{
return _applicationHost.SystemUpdateLevel;
}
private TimeSpan GetCacheLength() private TimeSpan GetCacheLength()
{ {
switch (_config.CommonConfiguration.SystemUpdateLevel) switch (GetSystemUpdateLevel())
{ {
case PackageVersionClass.Beta: case PackageVersionClass.Beta:
return TimeSpan.FromMinutes(30); return TimeSpan.FromMinutes(30);
@ -424,10 +429,12 @@ namespace Emby.Server.Implementations.Updates
.ToList(); .ToList();
} }
var systemUpdateLevel = GetSystemUpdateLevel();
// Figure out what needs to be installed // Figure out what needs to be installed
var packages = plugins.Select(p => 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; return latestPluginInfo != null && GetPackageVersion(latestPluginInfo) > p.Version ? latestPluginInfo : null;

View File

@ -157,5 +157,7 @@ namespace MediaBrowser.Common
/// <param name="type">The type.</param> /// <param name="type">The type.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
object CreateInstance(Type type); object CreateInstance(Type type);
PackageVersionClass SystemUpdateLevel { get; }
} }
} }

View File

@ -12,6 +12,8 @@ using MediaBrowser.IsoMounter;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System; using MediaBrowser.Model.System;
using MediaBrowser.Model.Updates;
using MediaBrowser.Server.Startup.Common;
namespace MediaBrowser.Server.Mono namespace MediaBrowser.Server.Mono
{ {
@ -40,6 +42,11 @@ namespace MediaBrowser.Server.Mono
return new SyncManager(); return new SyncManager();
} }
public override PackageVersionClass SystemUpdateLevel
{
get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); }
}
protected override void RestartInternal() protected override void RestartInternal()
{ {
MainClass.Restart(StartupOptions); MainClass.Restart(StartupOptions);

View File

@ -77,6 +77,7 @@
<Compile Include="IO\MemoryStreamProvider.cs" /> <Compile Include="IO\MemoryStreamProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SystemEvents.cs" /> <Compile Include="SystemEvents.cs" />
<Compile Include="UpdateLevelHelper.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj"> <ProjectReference Include="..\Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj">

View File

@ -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;
}
}
}

View File

@ -17,6 +17,8 @@ using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System; using MediaBrowser.Model.System;
using MediaBrowser.Model.Updates;
using MediaBrowser.Server.Startup.Common;
using MediaBrowser.ServerApplication.Native; using MediaBrowser.ServerApplication.Native;
namespace MediaBrowser.ServerApplication namespace MediaBrowser.ServerApplication
@ -53,6 +55,11 @@ namespace MediaBrowser.ServerApplication
LoopUtil.Run(appName); LoopUtil.Run(appName);
} }
public override PackageVersionClass SystemUpdateLevel
{
get { return UpdateLevelHelper.GetSystemUpdateLevel(ConfigurationManager); }
}
protected override List<Assembly> GetAssembliesWithPartsInternal() protected override List<Assembly> GetAssembliesWithPartsInternal()
{ {
var list = new List<Assembly>(); var list = new List<Assembly>();

View File

@ -1,3 +1,3 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.2.12.1")] [assembly: AssemblyVersion("3.2.12.2")]