consolidate os display name

This commit is contained in:
Luke Pulverenti
2014-11-23 18:10:41 -05:00
parent 1923de72bf
commit 2df4273ee0
13 changed files with 226 additions and 195 deletions

View File

@@ -266,6 +266,11 @@ namespace MediaBrowser.Server.Startup.Common
}
}
public override string OperatingSystemDisplayName
{
get { return NativeApp.Environment.OperatingSystemVersionString; }
}
public override bool IsRunningAsService
{
get { return NativeApp.IsRunningAsService; }
@@ -531,7 +536,7 @@ namespace MediaBrowser.Server.Startup.Common
/// <returns>Task.</returns>
private async Task RegisterMediaEncoder(IProgress<double> progress)
{
var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager)
var info = await new FFMpegDownloader(Logger, ApplicationPaths, HttpClient, ZipClient, FileSystemManager, NativeApp.Environment)
.GetFFMpegInfo(NativeApp.Environment, _startupOptions, progress).ConfigureAwait(false);
new FFmpegValidator(Logger, ApplicationPaths).Validate(info);
@@ -909,7 +914,7 @@ namespace MediaBrowser.Server.Startup.Common
CachePath = ApplicationPaths.CachePath,
MacAddress = GetMacAddress(),
HttpServerPortNumber = HttpServerPort,
OperatingSystem = Environment.OSVersion.ToString(),
OperatingSystem = OperatingSystemDisplayName,
CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate,
WanAddress = ConnectManager.WanApiAddress,

View File

@@ -22,19 +22,21 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
private readonly ILogger _logger;
private readonly IZipClient _zipClient;
private readonly IFileSystem _fileSystem;
private readonly NativeEnvironment _environment;
private readonly string[] _fontUrls =
{
"https://github.com/MediaBrowser/MediaBrowser.Resources/raw/master/ffmpeg/ARIALUNI.7z"
};
public FFMpegDownloader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem)
public FFMpegDownloader(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient, IZipClient zipClient, IFileSystem fileSystem, NativeEnvironment environment)
{
_logger = logger;
_appPaths = appPaths;
_httpClient = httpClient;
_zipClient = zipClient;
_fileSystem = fileSystem;
_environment = environment;
}
public async Task<FFMpegInfo> GetFFMpegInfo(NativeEnvironment environment, StartupOptions options, IProgress<double> progress)
@@ -240,7 +242,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
private void SetFilePermissions(string targetFolder, string file)
{
// Linux: File permission to 666, and user's execute bit
if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
if (_environment.OperatingSystem == OperatingSystem.Bsd || _environment.OperatingSystem == OperatingSystem.Linux || _environment.OperatingSystem == OperatingSystem.Osx)
{
Syscall.chmod(Path.Combine(targetFolder, Path.GetFileName(file)), FilePermissions.DEFFILEMODE | FilePermissions.S_IXUSR);
}

View File

@@ -1,5 +1,4 @@
using System;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Logging;
using System.Collections.Generic;
using System.Reflection;

View File

@@ -5,6 +5,7 @@ namespace MediaBrowser.Server.Startup.Common
{
public OperatingSystem OperatingSystem { get; set; }
public Architecture SystemArchitecture { get; set; }
public string OperatingSystemVersionString { get; set; }
}
public enum OperatingSystem