mirror of https://github.com/jellyfin/jellyfin.git
update core projects
This commit is contained in:
parent
f8dd02bb66
commit
918b9ca86d
|
@ -172,7 +172,7 @@ namespace Emby.Common.Implementations
|
||||||
|
|
||||||
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
|
protected ICryptoProvider CryptographyProvider = new CryptographyProvider();
|
||||||
|
|
||||||
protected IEnvironmentInfo EnvironmentInfo = new Emby.Common.Implementations.EnvironmentInfo.EnvironmentInfo();
|
protected IEnvironmentInfo EnvironmentInfo { get; private set; }
|
||||||
|
|
||||||
private DeviceId _deviceId;
|
private DeviceId _deviceId;
|
||||||
public string SystemId
|
public string SystemId
|
||||||
|
@ -205,8 +205,11 @@ namespace Emby.Common.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected BaseApplicationHost(TApplicationPathsType applicationPaths,
|
protected BaseApplicationHost(TApplicationPathsType applicationPaths,
|
||||||
ILogManager logManager,
|
ILogManager logManager,
|
||||||
IFileSystem fileSystem)
|
IFileSystem fileSystem,
|
||||||
|
IEnvironmentInfo environmentInfo)
|
||||||
{
|
{
|
||||||
|
EnvironmentInfo = environmentInfo;
|
||||||
|
|
||||||
// hack alert, until common can target .net core
|
// hack alert, until common can target .net core
|
||||||
BaseExtensions.CryptographyProvider = CryptographyProvider;
|
BaseExtensions.CryptographyProvider = CryptographyProvider;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace Emby.Common.Implementations.EnvironmentInfo
|
||||||
{
|
{
|
||||||
public class EnvironmentInfo : IEnvironmentInfo
|
public class EnvironmentInfo : IEnvironmentInfo
|
||||||
{
|
{
|
||||||
|
public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; }
|
||||||
|
|
||||||
public MediaBrowser.Model.System.OperatingSystem OperatingSystem
|
public MediaBrowser.Model.System.OperatingSystem OperatingSystem
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -66,5 +68,32 @@ namespace Emby.Common.Implementations.EnvironmentInfo
|
||||||
return "1.0";
|
return "1.0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MediaBrowser.Model.System.Architecture SystemArchitecture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (CustomArchitecture.HasValue)
|
||||||
|
{
|
||||||
|
return CustomArchitecture.Value;
|
||||||
|
}
|
||||||
|
#if NET46
|
||||||
|
return Environment.Is64BitOperatingSystem ? MediaBrowser.Model.System.Architecture.X64 : MediaBrowser.Model.System.Architecture.X86;
|
||||||
|
#elif NETSTANDARD1_6
|
||||||
|
switch(System.Runtime.InteropServices.RuntimeInformation.OSArchitecture)
|
||||||
|
{
|
||||||
|
case System.Runtime.InteropServices.Architecture.Arm:
|
||||||
|
return MediaBrowser.Model.System.Architecture.Arm;
|
||||||
|
case System.Runtime.InteropServices.Architecture.Arm64:
|
||||||
|
return MediaBrowser.Model.System.Architecture.Arm64;
|
||||||
|
case System.Runtime.InteropServices.Architecture.X64:
|
||||||
|
return MediaBrowser.Model.System.Architecture.X64;
|
||||||
|
case System.Runtime.InteropServices.Architecture.X86:
|
||||||
|
return MediaBrowser.Model.System.Architecture.X86;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return MediaBrowser.Model.System.Architecture.X64;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ using Emby.Server.Core;
|
||||||
using Emby.Server.Core.Data;
|
using Emby.Server.Core.Data;
|
||||||
using Emby.Server.Core.FFMpeg;
|
using Emby.Server.Core.FFMpeg;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common
|
namespace Emby.Server.Core
|
||||||
{
|
{
|
||||||
public interface INativeApp
|
public interface INativeApp
|
||||||
{
|
{
|
||||||
|
@ -19,18 +19,8 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Authorizes the server.
|
/// Authorizes the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="udpPort">The UDP port.</param>
|
|
||||||
/// <param name="httpServerPort">The HTTP server port.</param>
|
|
||||||
/// <param name="httpsServerPort">The HTTPS server port.</param>
|
|
||||||
/// <param name="tempDirectory">The temporary directory.</param>
|
|
||||||
void AuthorizeServer(int udpPort, int httpServerPort, int httpsServerPort, string applicationPath, string tempDirectory);
|
void AuthorizeServer(int udpPort, int httpServerPort, int httpsServerPort, string applicationPath, string tempDirectory);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the environment.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The environment.</value>
|
|
||||||
NativeEnvironment Environment { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether [supports running as service].
|
/// Gets a value indicating whether [supports running as service].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -54,12 +44,6 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [supports autorun at startup]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [supports autorun at startup]; otherwise, <c>false</c>.</value>
|
||||||
bool SupportsAutoRunAtStartup { get; }
|
bool SupportsAutoRunAtStartup { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether [supports library monitor].
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
|
|
||||||
bool SupportsLibraryMonitor { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance can self update.
|
/// Gets a value indicating whether this instance can self update.
|
|
@ -26,12 +26,6 @@ namespace MediaBrowser.Controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
bool SupportsAutoRunAtStartup { get; }
|
bool SupportsAutoRunAtStartup { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether [supports library monitor].
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if [supports library monitor]; otherwise, <c>false</c>.</value>
|
|
||||||
bool SupportsLibraryMonitor { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the HTTP server port.
|
/// Gets the HTTP server port.
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{
|
{
|
||||||
X86 = 0,
|
X86 = 0,
|
||||||
X64 = 1,
|
X64 = 1,
|
||||||
Arm = 2
|
Arm = 2,
|
||||||
|
Arm64 = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace MediaBrowser.Model.System
|
||||||
MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; }
|
MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; }
|
||||||
string OperatingSystemName { get; }
|
string OperatingSystemName { get; }
|
||||||
string OperatingSystemVersion { get; }
|
string OperatingSystemVersion { get; }
|
||||||
|
Architecture SystemArchitecture { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum OperatingSystem
|
public enum OperatingSystem
|
||||||
|
|
|
@ -12,7 +12,6 @@ using Emby.Server.Core;
|
||||||
using Emby.Server.Core.Data;
|
using Emby.Server.Core.Data;
|
||||||
using Emby.Server.Core.FFMpeg;
|
using Emby.Server.Core.FFMpeg;
|
||||||
using MediaBrowser.Model.System;
|
using MediaBrowser.Model.System;
|
||||||
using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mono.Native
|
namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
|
@ -20,11 +19,13 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
protected StartupOptions StartupOptions { get; private set; }
|
protected StartupOptions StartupOptions { get; private set; }
|
||||||
protected ILogger Logger { get; private set; }
|
protected ILogger Logger { get; private set; }
|
||||||
|
private readonly MonoEnvironmentInfo _environment;
|
||||||
|
|
||||||
public MonoApp(StartupOptions startupOptions, ILogger logger)
|
public MonoApp(StartupOptions startupOptions, ILogger logger, MonoEnvironmentInfo environment)
|
||||||
{
|
{
|
||||||
StartupOptions = startupOptions;
|
StartupOptions = startupOptions;
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
_environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -77,11 +78,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
var list = new List<Assembly>();
|
var list = new List<Assembly>();
|
||||||
|
|
||||||
if (Environment.OperatingSystem == Startup.Common.OperatingSystem.Linux)
|
|
||||||
{
|
|
||||||
list.AddRange(GetLinuxAssemblies());
|
|
||||||
}
|
|
||||||
|
|
||||||
list.Add(GetType().Assembly);
|
list.Add(GetType().Assembly);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
@ -91,7 +87,7 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
var list = new List<Assembly>();
|
var list = new List<Assembly>();
|
||||||
|
|
||||||
list.Add(typeof(LinuxIsoManager).Assembly);
|
//list.Add(typeof(LinuxIsoManager).Assembly);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -100,12 +96,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private NativeEnvironment _nativeEnvironment;
|
|
||||||
public NativeEnvironment Environment
|
|
||||||
{
|
|
||||||
get { return _nativeEnvironment ?? (_nativeEnvironment = GetEnvironmentInfo()); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SupportsRunningAsService
|
public bool SupportsRunningAsService
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -122,14 +112,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsLibraryMonitor
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Environment.OperatingSystem != Startup.Common.OperatingSystem.Osx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ConfigureAutoRun(bool autorun)
|
public void ConfigureAutoRun(bool autorun)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -139,96 +121,29 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
return new NetworkManager(logger);
|
return new NetworkManager(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private NativeEnvironment GetEnvironmentInfo()
|
|
||||||
{
|
|
||||||
var info = new NativeEnvironment
|
|
||||||
{
|
|
||||||
OperatingSystem = Startup.Common.OperatingSystem.Linux
|
|
||||||
};
|
|
||||||
|
|
||||||
var uname = GetUnixName();
|
|
||||||
|
|
||||||
var sysName = uname.sysname ?? string.Empty;
|
|
||||||
|
|
||||||
if (string.Equals(sysName, "Darwin", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
info.OperatingSystem = Startup.Common.OperatingSystem.Osx;
|
|
||||||
}
|
|
||||||
else if (string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
info.OperatingSystem = Startup.Common.OperatingSystem.Linux;
|
|
||||||
}
|
|
||||||
else if (string.Equals(sysName, "BSD", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
info.OperatingSystem = Startup.Common.OperatingSystem.Bsd;
|
|
||||||
}
|
|
||||||
|
|
||||||
var archX86 = new Regex("(i|I)[3-6]86");
|
|
||||||
|
|
||||||
if (archX86.IsMatch(uname.machine))
|
|
||||||
{
|
|
||||||
info.SystemArchitecture = Architecture.X86;
|
|
||||||
}
|
|
||||||
else if (string.Equals(uname.machine, "x86_64", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
info.SystemArchitecture = Architecture.X64;
|
|
||||||
}
|
|
||||||
else if (uname.machine.StartsWith("arm", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
info.SystemArchitecture = Architecture.Arm;
|
|
||||||
}
|
|
||||||
else if (System.Environment.Is64BitOperatingSystem)
|
|
||||||
{
|
|
||||||
info.SystemArchitecture = Architecture.X64;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
info.SystemArchitecture = Architecture.X86;
|
|
||||||
}
|
|
||||||
|
|
||||||
info.OperatingSystemVersionString = string.IsNullOrWhiteSpace(sysName) ?
|
|
||||||
System.Environment.OSVersion.VersionString :
|
|
||||||
sysName;
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Uname _unixName;
|
|
||||||
|
|
||||||
private Uname GetUnixName()
|
|
||||||
{
|
|
||||||
if (_unixName == null)
|
|
||||||
{
|
|
||||||
var uname = new Uname();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utsname utsname;
|
|
||||||
var callResult = Syscall.uname(out utsname);
|
|
||||||
if (callResult == 0)
|
|
||||||
{
|
|
||||||
uname.sysname = utsname.sysname ?? string.Empty;
|
|
||||||
uname.machine = utsname.machine ?? string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Error getting unix name", ex);
|
|
||||||
}
|
|
||||||
_unixName = uname;
|
|
||||||
}
|
|
||||||
return _unixName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Uname
|
|
||||||
{
|
|
||||||
public string sysname = string.Empty;
|
|
||||||
public string machine = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FFMpegInstallInfo GetFfmpegInstallInfo()
|
public FFMpegInstallInfo GetFfmpegInstallInfo()
|
||||||
{
|
{
|
||||||
return GetInfo(Environment);
|
var info = new FFMpegInstallInfo();
|
||||||
|
|
||||||
|
// Windows builds: http://ffmpeg.zeranoe.com/builds/
|
||||||
|
// Linux builds: http://johnvansickle.com/ffmpeg/
|
||||||
|
// OS X builds: http://ffmpegmac.net/
|
||||||
|
// OS X x64: http://www.evermeet.cx/ffmpeg/
|
||||||
|
|
||||||
|
if (_environment.IsBsd)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (_environment.OperatingSystem == Model.System.OperatingSystem.Linux)
|
||||||
|
{
|
||||||
|
info.ArchiveType = "7z";
|
||||||
|
info.Version = "20160215";
|
||||||
|
}
|
||||||
|
|
||||||
|
// No version available - user requirement
|
||||||
|
info.DownloadUrls = new string[] { };
|
||||||
|
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LaunchUrl(string url)
|
public void LaunchUrl(string url)
|
||||||
|
@ -241,33 +156,6 @@ namespace MediaBrowser.Server.Mono.Native
|
||||||
return new DbConnector(Logger);
|
return new DbConnector(Logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FFMpegInstallInfo GetInfo(NativeEnvironment environment)
|
|
||||||
{
|
|
||||||
var info = new FFMpegInstallInfo();
|
|
||||||
|
|
||||||
// Windows builds: http://ffmpeg.zeranoe.com/builds/
|
|
||||||
// Linux builds: http://johnvansickle.com/ffmpeg/
|
|
||||||
// OS X builds: http://ffmpegmac.net/
|
|
||||||
// OS X x64: http://www.evermeet.cx/ffmpeg/
|
|
||||||
|
|
||||||
switch (environment.OperatingSystem)
|
|
||||||
{
|
|
||||||
case OperatingSystem.Osx:
|
|
||||||
case OperatingSystem.Bsd:
|
|
||||||
break;
|
|
||||||
case OperatingSystem.Linux:
|
|
||||||
|
|
||||||
info.ArchiveType = "7z";
|
|
||||||
info.Version = "20160215";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No version available - user requirement
|
|
||||||
info.DownloadUrls = new string[] { };
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EnableLoopback(string appName)
|
public void EnableLoopback(string appName)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,17 @@ using System.Net;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Emby.Common.Implementations.EnvironmentInfo;
|
||||||
using Emby.Common.Implementations.IO;
|
using Emby.Common.Implementations.IO;
|
||||||
using Emby.Common.Implementations.Logging;
|
using Emby.Common.Implementations.Logging;
|
||||||
using Emby.Server.Core;
|
using Emby.Server.Core;
|
||||||
using Emby.Server.Implementations.IO;
|
using Emby.Server.Implementations.IO;
|
||||||
|
using MediaBrowser.Model.System;
|
||||||
|
using Mono.Unix.Native;
|
||||||
|
using NLog;
|
||||||
|
using ILogger = MediaBrowser.Model.Logging.ILogger;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Mono
|
namespace MediaBrowser.Server.Mono
|
||||||
{
|
{
|
||||||
|
@ -80,9 +86,11 @@ namespace MediaBrowser.Server.Mono
|
||||||
var fileSystem = new MonoFileSystem(logManager.GetLogger("FileSystem"), false, false);
|
var fileSystem = new MonoFileSystem(logManager.GetLogger("FileSystem"), false, false);
|
||||||
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
|
||||||
|
|
||||||
var nativeApp = new MonoApp(options, logManager.GetLogger("App"));
|
var environmentInfo = GetEnvironmentInfo();
|
||||||
|
|
||||||
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, nativeApp, new PowerManagement(), "emby.mono.zip");
|
var nativeApp = new MonoApp(options, logManager.GetLogger("App"), environmentInfo);
|
||||||
|
|
||||||
|
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, nativeApp, new PowerManagement(), "emby.mono.zip", environmentInfo);
|
||||||
|
|
||||||
if (options.ContainsOption("-v"))
|
if (options.ContainsOption("-v"))
|
||||||
{
|
{
|
||||||
|
@ -107,6 +115,87 @@ namespace MediaBrowser.Server.Mono
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static MonoEnvironmentInfo GetEnvironmentInfo()
|
||||||
|
{
|
||||||
|
var info = new MonoEnvironmentInfo();
|
||||||
|
|
||||||
|
var uname = GetUnixName();
|
||||||
|
|
||||||
|
var sysName = uname.sysname ?? string.Empty;
|
||||||
|
|
||||||
|
if (string.Equals(sysName, "Darwin", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
//info.OperatingSystem = Startup.Common.OperatingSystem.Osx;
|
||||||
|
}
|
||||||
|
else if (string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
//info.OperatingSystem = Startup.Common.OperatingSystem.Linux;
|
||||||
|
}
|
||||||
|
else if (string.Equals(sysName, "BSD", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
//info.OperatingSystem = Startup.Common.OperatingSystem.Bsd;
|
||||||
|
info.IsBsd = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var archX86 = new Regex("(i|I)[3-6]86");
|
||||||
|
|
||||||
|
if (archX86.IsMatch(uname.machine))
|
||||||
|
{
|
||||||
|
info.CustomArchitecture = Architecture.X86;
|
||||||
|
}
|
||||||
|
else if (string.Equals(uname.machine, "x86_64", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
info.CustomArchitecture = Architecture.X64;
|
||||||
|
}
|
||||||
|
else if (uname.machine.StartsWith("arm", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
info.CustomArchitecture = Architecture.Arm;
|
||||||
|
}
|
||||||
|
else if (System.Environment.Is64BitOperatingSystem)
|
||||||
|
{
|
||||||
|
info.CustomArchitecture = Architecture.X64;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info.CustomArchitecture = Architecture.X86;
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Uname _unixName;
|
||||||
|
|
||||||
|
private static Uname GetUnixName()
|
||||||
|
{
|
||||||
|
if (_unixName == null)
|
||||||
|
{
|
||||||
|
var uname = new Uname();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Utsname utsname;
|
||||||
|
var callResult = Syscall.uname(out utsname);
|
||||||
|
if (callResult == 0)
|
||||||
|
{
|
||||||
|
uname.sysname = utsname.sysname ?? string.Empty;
|
||||||
|
uname.machine = utsname.machine ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error getting unix name", ex);
|
||||||
|
}
|
||||||
|
_unixName = uname;
|
||||||
|
}
|
||||||
|
return _unixName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Uname
|
||||||
|
{
|
||||||
|
public string sysname = string.Empty;
|
||||||
|
public string machine = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the SessionEnding event of the SystemEvents control.
|
/// Handles the SessionEnding event of the SystemEvents control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -192,4 +281,9 @@ namespace MediaBrowser.Server.Mono
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MonoEnvironmentInfo : EnvironmentInfo
|
||||||
|
{
|
||||||
|
public bool IsBsd { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,8 +277,9 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
INativeApp nativeApp,
|
INativeApp nativeApp,
|
||||||
IPowerManagement powerManagement,
|
IPowerManagement powerManagement,
|
||||||
string releaseAssetFilename)
|
string releaseAssetFilename,
|
||||||
: base(applicationPaths, logManager, fileSystem)
|
IEnvironmentInfo environmentInfo)
|
||||||
|
: base(applicationPaths, logManager, fileSystem, environmentInfo)
|
||||||
{
|
{
|
||||||
_startupOptions = options;
|
_startupOptions = options;
|
||||||
_releaseAssetFilename = releaseAssetFilename;
|
_releaseAssetFilename = releaseAssetFilename;
|
||||||
|
@ -301,11 +302,6 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string OperatingSystemDisplayName
|
|
||||||
{
|
|
||||||
get { return NativeApp.Environment.OperatingSystemVersionString; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsRunningAsService
|
public override bool IsRunningAsService
|
||||||
{
|
{
|
||||||
get { return NativeApp.IsRunningAsService; }
|
get { return NativeApp.IsRunningAsService; }
|
||||||
|
@ -316,11 +312,6 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
get { return NativeApp.SupportsRunningAsService; }
|
get { return NativeApp.SupportsRunningAsService; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsLibraryMonitor
|
|
||||||
{
|
|
||||||
get { return NativeApp.SupportsLibraryMonitor; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1300,7 +1291,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
HttpServerPortNumber = HttpPort,
|
HttpServerPortNumber = HttpPort,
|
||||||
SupportsHttps = SupportsHttps,
|
SupportsHttps = SupportsHttps,
|
||||||
HttpsPortNumber = HttpsPort,
|
HttpsPortNumber = HttpsPort,
|
||||||
OperatingSystem = NativeApp.Environment.OperatingSystem.ToString(),
|
OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
|
||||||
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanSelfUpdate = CanSelfUpdate,
|
CanSelfUpdate = CanSelfUpdate,
|
||||||
|
@ -1312,9 +1303,9 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
SupportsRunningAsService = SupportsRunningAsService,
|
SupportsRunningAsService = SupportsRunningAsService,
|
||||||
ServerName = FriendlyName,
|
ServerName = FriendlyName,
|
||||||
LocalAddress = localAddress,
|
LocalAddress = localAddress,
|
||||||
SupportsLibraryMonitor = SupportsLibraryMonitor,
|
SupportsLibraryMonitor = true,
|
||||||
EncoderLocationType = MediaEncoder.EncoderLocationType,
|
EncoderLocationType = MediaEncoder.EncoderLocationType,
|
||||||
SystemArchitecture = NativeApp.Environment.SystemArchitecture,
|
SystemArchitecture = EnvironmentInfo.SystemArchitecture,
|
||||||
SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel,
|
SystemUpdateLevel = ConfigurationManager.CommonConfiguration.SystemUpdateLevel,
|
||||||
PackageName = _startupOptions.GetOption("-package")
|
PackageName = _startupOptions.GetOption("-package")
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,6 @@
|
||||||
<Compile Include="Cryptography\X509Extensions.cs" />
|
<Compile Include="Cryptography\X509Extensions.cs" />
|
||||||
<Compile Include="Cryptography\X520Attributes.cs" />
|
<Compile Include="Cryptography\X520Attributes.cs" />
|
||||||
<Compile Include="HttpServerFactory.cs" />
|
<Compile Include="HttpServerFactory.cs" />
|
||||||
<Compile Include="INativeApp.cs" />
|
|
||||||
<Compile Include="IO\MemoryStreamProvider.cs" />
|
<Compile Include="IO\MemoryStreamProvider.cs" />
|
||||||
<Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" />
|
<Compile Include="LiveTv\TunerHosts\SatIp\ChannelScan.cs" />
|
||||||
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\ReportBlock.cs" />
|
<Compile Include="LiveTv\TunerHosts\SatIp\Rtcp\ReportBlock.cs" />
|
||||||
|
@ -138,7 +137,6 @@
|
||||||
<Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" />
|
<Compile Include="LiveTv\TunerHosts\SatIp\SatIpHost.cs" />
|
||||||
<Compile Include="LiveTv\TunerHosts\SatIp\TransmissionMode.cs" />
|
<Compile Include="LiveTv\TunerHosts\SatIp\TransmissionMode.cs" />
|
||||||
<Compile Include="LiveTv\TunerHosts\SatIp\Utils.cs" />
|
<Compile Include="LiveTv\TunerHosts\SatIp\Utils.cs" />
|
||||||
<Compile Include="NativeEnvironment.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SystemEvents.cs" />
|
<Compile Include="SystemEvents.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common
|
|
||||||
{
|
|
||||||
public class NativeEnvironment
|
|
||||||
{
|
|
||||||
public OperatingSystem OperatingSystem { get; set; }
|
|
||||||
public Architecture SystemArchitecture { get; set; }
|
|
||||||
public string OperatingSystemVersionString { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum OperatingSystem
|
|
||||||
{
|
|
||||||
Windows = 0,
|
|
||||||
Osx = 1,
|
|
||||||
Bsd = 2,
|
|
||||||
Linux = 3
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,6 +17,7 @@ using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Emby.Common.Implementations.EnvironmentInfo;
|
||||||
using Emby.Common.Implementations.IO;
|
using Emby.Common.Implementations.IO;
|
||||||
using Emby.Common.Implementations.Logging;
|
using Emby.Common.Implementations.Logging;
|
||||||
using Emby.Server.Core;
|
using Emby.Server.Core;
|
||||||
|
@ -324,7 +325,8 @@ namespace MediaBrowser.ServerApplication
|
||||||
fileSystem,
|
fileSystem,
|
||||||
nativeApp,
|
nativeApp,
|
||||||
new PowerManagement(),
|
new PowerManagement(),
|
||||||
"emby.windows.zip");
|
"emby.windows.zip",
|
||||||
|
new EnvironmentInfo());
|
||||||
|
|
||||||
var initProgress = new Progress<double>();
|
var initProgress = new Progress<double>();
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ using Emby.Server.Core.FFMpeg;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.System;
|
|
||||||
using OperatingSystem = MediaBrowser.Server.Startup.Common.OperatingSystem;
|
|
||||||
|
|
||||||
namespace MediaBrowser.ServerApplication.Native
|
namespace MediaBrowser.ServerApplication.Native
|
||||||
{
|
{
|
||||||
|
@ -49,19 +47,6 @@ namespace MediaBrowser.ServerApplication.Native
|
||||||
ServerAuthorization.AuthorizeServer(udpPort, httpServerPort, httpsPort, applicationPath, tempDirectory);
|
ServerAuthorization.AuthorizeServer(udpPort, httpServerPort, httpsPort, applicationPath, tempDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NativeEnvironment Environment
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new NativeEnvironment
|
|
||||||
{
|
|
||||||
OperatingSystem = OperatingSystem.Windows,
|
|
||||||
SystemArchitecture = System.Environment.Is64BitOperatingSystem ? Architecture.X64 : Architecture.X86,
|
|
||||||
OperatingSystemVersionString = System.Environment.OSVersion.VersionString
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SupportsLibraryMonitor
|
public bool SupportsLibraryMonitor
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
|
|
Loading…
Reference in New Issue