diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 07b0807b72..37a9e7715d 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -11,7 +11,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
-using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
@@ -113,15 +112,11 @@ namespace Emby.Server.Implementations
///
public abstract class ApplicationHost : IServerApplicationHost, IAsyncDisposable, IDisposable
{
- ///
- /// The environment variable prefixes to log at server startup.
- ///
- private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
-
///
/// The disposable parts.
///
private readonly ConcurrentDictionary _disposableParts = new();
+ private readonly DeviceId _deviceId;
private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig;
@@ -130,7 +125,6 @@ namespace Emby.Server.Implementations
private readonly IPluginManager _pluginManager;
private List _creatingInstances;
- private IMediaEncoder _mediaEncoder;
private ISessionManager _sessionManager;
///
@@ -139,8 +133,6 @@ namespace Emby.Server.Implementations
/// All concrete types.
private Type[] _allConcreteTypes;
- private DeviceId _deviceId;
-
private bool _disposed = false;
///
@@ -164,6 +156,7 @@ namespace Emby.Server.Implementations
Logger = LoggerFactory.CreateLogger();
_fileSystemManager.AddShortcutHandler(new MbLinkShortcutHandler(_fileSystemManager));
+ _deviceId = new DeviceId(ApplicationPaths, LoggerFactory);
ApplicationVersion = typeof(ApplicationHost).Assembly.GetName().Version;
ApplicationVersionString = ApplicationVersion.ToString(3);
@@ -191,23 +184,9 @@ namespace Emby.Server.Implementations
public bool CoreStartupHasCompleted { get; private set; }
- public virtual bool CanLaunchWebBrowser
- {
- get
- {
- if (!Environment.UserInteractive)
- {
- return false;
- }
-
- if (_startupOptions.IsService)
- {
- return false;
- }
-
- return OperatingSystem.IsWindows() || OperatingSystem.IsMacOS();
- }
- }
+ public virtual bool CanLaunchWebBrowser => Environment.UserInteractive
+ && !_startupOptions.IsService
+ && (OperatingSystem.IsWindows() || OperatingSystem.IsMacOS());
///
/// Gets the singleton instance.
@@ -284,15 +263,7 @@ namespace Emby.Server.Implementations
/// The application name.
public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName;
- public string SystemId
- {
- get
- {
- _deviceId ??= new DeviceId(ApplicationPaths, LoggerFactory);
-
- return _deviceId.Value;
- }
- }
+ public string SystemId => _deviceId.Value;
///
public string Name => ApplicationProductName;
@@ -445,7 +416,7 @@ namespace Emby.Server.Implementations
ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
ConfigurationManager.NamedConfigurationUpdated += OnConfigurationUpdated;
- _mediaEncoder.SetFFmpegPath();
+ Resolve().SetFFmpegPath();
Logger.LogInformation("ServerId: {ServerId}", SystemId);
@@ -655,7 +626,6 @@ namespace Emby.Server.Implementations
var localizationManager = (LocalizationManager)Resolve();
await localizationManager.LoadAll().ConfigureAwait(false);
- _mediaEncoder = Resolve();
_sessionManager = Resolve();
SetStaticProperties();
@@ -666,36 +636,6 @@ namespace Emby.Server.Implementations
FindParts();
}
- public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths)
- {
- // Distinct these to prevent users from reporting problems that aren't actually problems
- var commandLineArgs = Environment
- .GetCommandLineArgs()
- .Distinct();
-
- // Get all relevant environment variables
- var allEnvVars = Environment.GetEnvironmentVariables();
- var relevantEnvVars = new Dictionary
public static class StartupHelpers
{
+ private static readonly string[] _relevantEnvVarPrefixes = { "JELLYFIN_", "DOTNET_", "ASPNETCORE_" };
+
+ ///
+ /// Logs relevant environment variables and information about the host.
+ ///
+ /// The logger to use.
+ /// The application paths to use.
+ public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths)
+ {
+ // Distinct these to prevent users from reporting problems that aren't actually problems
+ var commandLineArgs = Environment
+ .GetCommandLineArgs()
+ .Distinct();
+
+ // Get all relevant environment variables
+ var allEnvVars = Environment.GetEnvironmentVariables();
+ var relevantEnvVars = new Dictionary