diff options
| author | Tthecreator <epostvanthomas@kpnmail.nl> | 2019-01-22 15:22:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 15:22:42 +0000 |
| commit | 189b99df16bd4c93cc96422d7282d01d9ff5b82f (patch) | |
| tree | 26d7da95fe3e3b2772b8b39a2463a6c0ac7652fc /Jellyfin.Server/Program.cs | |
| parent | a00c0defa8cb22774f5dc8a7d566eb36ac7307e8 (diff) | |
| parent | edcfd8b565f632088c8b1f826db8e2fbecf9790d (diff) | |
Merge pull request #1 from jellyfin/dev
Update from jellyfin repo
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 46a80b492..0510548b5 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -9,17 +9,14 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Emby.Drawing; -using Emby.Drawing.Skia; using Emby.Server.Implementations; using Emby.Server.Implementations.EnvironmentInfo; using Emby.Server.Implementations.IO; using Emby.Server.Implementations.Networking; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Net; using MediaBrowser.Controller.Drawing; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Globalization; -using MediaBrowser.Model.System; +using MediaBrowser.Model.IO; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Serilog; @@ -90,7 +87,7 @@ namespace Jellyfin.Server // Allow all https requests ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); - var fileSystem = new ManagedFileSystem(_loggerFactory.CreateLogger("FileSystem"), environmentInfo, null, appPaths.TempDirectory, true); + var fileSystem = new ManagedFileSystem(_loggerFactory, environmentInfo, null, appPaths.TempDirectory, true); using (var appHost = new CoreAppHost( appPaths, @@ -99,12 +96,12 @@ namespace Jellyfin.Server fileSystem, environmentInfo, new NullImageEncoder(), - new SystemEvents(_loggerFactory.CreateLogger("SystemEvents")), - new NetworkManager(_loggerFactory.CreateLogger("NetworkManager"), environmentInfo))) + new SystemEvents(), + new NetworkManager(_loggerFactory, environmentInfo))) { appHost.Init(); - appHost.ImageProcessor.ImageEncoder = getImageEncoder(_logger, fileSystem, options, () => appHost.HttpClient, appPaths, environmentInfo, appHost.LocalizationManager); + appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager); _logger.LogInformation("Running startup tasks"); @@ -257,28 +254,25 @@ namespace Jellyfin.Server } } - public static IImageEncoder getImageEncoder( - ILogger logger, + public static IImageEncoder GetImageEncoder( IFileSystem fileSystem, - StartupOptions startupOptions, - Func<IHttpClient> httpClient, IApplicationPaths appPaths, - IEnvironmentInfo environment, ILocalizationManager localizationManager) { try { - return new SkiaEncoder(logger, appPaths, httpClient, fileSystem, localizationManager); + return new SkiaEncoder(_loggerFactory, appPaths, fileSystem, localizationManager); } catch (Exception ex) { - logger.LogInformation(ex, "Skia not available. Will fallback to NullIMageEncoder. {0}"); + _logger.LogInformation(ex, "Skia not available. Will fallback to NullIMageEncoder. {0}"); } return new NullImageEncoder(); } - private static MediaBrowser.Model.System.OperatingSystem getOperatingSystem() { + private static MediaBrowser.Model.System.OperatingSystem getOperatingSystem() + { switch (Environment.OSVersion.Platform) { case PlatformID.MacOSX: @@ -287,22 +281,22 @@ namespace Jellyfin.Server return MediaBrowser.Model.System.OperatingSystem.Windows; case PlatformID.Unix: default: - { - string osDescription = RuntimeInformation.OSDescription; - if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase)) - { - return MediaBrowser.Model.System.OperatingSystem.Linux; - } - else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase)) - { - return MediaBrowser.Model.System.OperatingSystem.OSX; - } - else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase)) { - return MediaBrowser.Model.System.OperatingSystem.BSD; + string osDescription = RuntimeInformation.OSDescription; + if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase)) + { + return MediaBrowser.Model.System.OperatingSystem.Linux; + } + else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase)) + { + return MediaBrowser.Model.System.OperatingSystem.OSX; + } + else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase)) + { + return MediaBrowser.Model.System.OperatingSystem.BSD; + } + throw new Exception($"Can't resolve OS with description: '{osDescription}'"); } - throw new Exception($"Can't resolve OS with description: '{osDescription}'"); - } } } @@ -340,7 +334,7 @@ namespace Jellyfin.Server } else { - commandLineArgsString = string .Join(" ", + commandLineArgsString = string.Join(" ", Environment.GetCommandLineArgs() .Skip(1) .Select(NormalizeCommandLineArgument) |
