The Free Software Media System - Server Backend & API
Remove useless properties from IEnvironmentInfo
Bond_009f520ddc9662e
diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.csindex faaed482a0..d82d2f2fb8 100644--- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs+++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs@@ -44,13 +44,13 @@ namespace IsoMounter_logger.LogDebug("[{0}] System PATH is currently set to [{1}].",Name,- EnvironmentInfo.GetEnvironmentVariable("PATH") ?? ""+ Environment.GetEnvironmentVariable("PATH") ?? "");_logger.LogDebug("[{0}] System path separator is [{1}].",Name,- EnvironmentInfo.PathSeparator+ Path.PathSeparator);_logger.LogDebug(@@ -118,25 +118,27 @@ namespace IsoMounterpublic bool CanMount(string path){- if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux) {- _logger.LogInformation(- "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].",- Name,- path,- Path.GetExtension(path),- EnvironmentInfo.OperatingSystem,- ExecutablesAvailable.ToString()- );-- if (ExecutablesAvailable) {- return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);- } else {- return false;- }- } else {+ if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Linux)+ {return false;}+ _logger.LogInformation(+ "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].",+ Name,+ path,+ Path.GetExtension(path),+ EnvironmentInfo.OperatingSystem,+ ExecutablesAvailable.ToString()+ );+ if (ExecutablesAvailable)+ {+ return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);+ }+ else+ {+ return false;+ }}public Task Install(CancellationToken cancellationToken)@@ -211,18 +213,16 @@ namespace IsoMounterprivate string GetFullPathForExecutable(string name){- foreach (string test in (EnvironmentInfo.GetEnvironmentVariable("PATH") ?? "").Split(EnvironmentInfo.PathSeparator)) {-+ foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator))+ {string path = test.Trim();if (!String.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {return FileSystem.GetFullPath(path);}-}- return String.Empty;-+ return string.Empty;}private uint GetUID()@@ -315,9 +315,9 @@ namespace IsoMounter);} else {-+throw new ArgumentNullException(nameof(isoPath));-+}try@@ -397,9 +397,9 @@ namespace IsoMounter);} else {-+throw new ArgumentNullException(nameof(mount));-+}if (GetUID() == 0) {@@ -444,7 +444,7 @@ namespace IsoMounter}#endregion-+#region Internal Methodsinternal void OnUnmount(LinuxMount mount)diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex fb053f0e4a..b020b33c31 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1188,8 +1188,7 @@ namespace Emby.Server.ImplementationsHttpClient,ZipClient,ProcessFactory,- 5000,- EnvironmentInfo);+ 5000);MediaEncoder = mediaEncoder;RegisterSingleInstance(MediaEncoder);@@ -1647,25 +1646,25 @@ namespace Emby.Server.Implementations// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that// This will prevent the .dll file from getting locked, and allow us to replace it when needed- // Include composable parts in the Api assembly+ // Include composable parts in the Api assemblylist.Add(GetAssembly(typeof(ApiEntryPoint)));- // Include composable parts in the Dashboard assembly+ // Include composable parts in the Dashboard assemblylist.Add(GetAssembly(typeof(DashboardService)));- // Include composable parts in the Model assembly+ // Include composable parts in the Model assemblylist.Add(GetAssembly(typeof(SystemInfo)));- // Include composable parts in the Common assembly+ // Include composable parts in the Common assemblylist.Add(GetAssembly(typeof(IApplicationHost)));- // Include composable parts in the Controller assembly+ // Include composable parts in the Controller assemblylist.Add(GetAssembly(typeof(IServerApplicationHost)));- // Include composable parts in the Providers assembly+ // Include composable parts in the Providers assemblylist.Add(GetAssembly(typeof(ProviderUtils)));- // Include composable parts in the Photos assembly+ // Include composable parts in the Photos assemblylist.Add(GetAssembly(typeof(PhotoProvider)));// Emby.Server implementations@@ -1674,16 +1673,16 @@ namespace Emby.Server.Implementations// MediaEncodinglist.Add(GetAssembly(typeof(MediaBrowser.MediaEncoding.Encoder.MediaEncoder)));- // Dlna+ // Dlnalist.Add(GetAssembly(typeof(DlnaEntryPoint)));- // Local metadata+ // Local metadatalist.Add(GetAssembly(typeof(BoxSetXmlSaver)));// Notificationslist.Add(GetAssembly(typeof(NotificationManager)));- // Xbmc+ // Xbmclist.Add(GetAssembly(typeof(ArtistNfoProvider)));list.AddRange(GetAssembliesWithPartsInternal().Select(i => new Tuple<Assembly, string>(i, null)));@@ -2219,7 +2218,7 @@ namespace Emby.Server.Implementations}/// <summary>- /// This returns localhost in the case of no external dns, and the hostname if the+ /// This returns localhost in the case of no external dns, and the hostname if the/// dns is prefixed with a valid Uri prefix./// </summary>/// <param name="externalDns">The external dns prefix to get the hostname of.</param>diff --git a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.csindex 03e10e7ea3..655867577b 100644--- a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs+++ b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs@@ -1,11 +1,9 @@using System;-using System.IO;using MediaBrowser.Model.System;using System.Runtime.InteropServices;namespace Emby.Server.Implementations.EnvironmentInfo{- // TODO: Rework @bondpublic class EnvironmentInfo : IEnvironmentInfo{public EnvironmentInfo(MediaBrowser.Model.System.OperatingSystem operatingSystem)@@ -39,29 +37,6 @@ namespace Emby.Server.Implementations.EnvironmentInfo}}- public char PathSeparator- {- get- {- return Path.PathSeparator;- }- }-public Architecture SystemArchitecture { get { return RuntimeInformation.OSArchitecture; } }-- public string GetEnvironmentVariable(string name)- {- return Environment.GetEnvironmentVariable(name);- }-- public string StackTrace- {- get { return Environment.StackTrace; }- }-- public void SetProcessEnvironmentVariable(string name, string value)- {- Environment.SetEnvironmentVariable(name, value);- }}}diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.csindex a93dd97421..a137955488 100644--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs@@ -70,7 +70,6 @@ namespace MediaBrowser.MediaEncoding.Encoderprivate readonly string _originalFFMpegPath;private readonly string _originalFFProbePath;private readonly int DefaultImageExtractionTimeoutMs;- private readonly IEnvironmentInfo _environmentInfo;public MediaEncoder(ILogger logger,IJsonSerializer jsonSerializer,@@ -89,8 +88,7 @@ namespace MediaBrowser.MediaEncoding.EncoderIHttpClient httpClient,IZipClient zipClient,IProcessFactory processFactory,- int defaultImageExtractionTimeoutMs,- IEnvironmentInfo environmentInfo)+ int defaultImageExtractionTimeoutMs){_logger = logger;_jsonSerializer = jsonSerializer;@@ -107,46 +105,13 @@ namespace MediaBrowser.MediaEncoding.Encoder_zipClient = zipClient;_processFactory = processFactory;DefaultImageExtractionTimeoutMs = defaultImageExtractionTimeoutMs;- _environmentInfo = environmentInfo;FFProbePath = ffProbePath;FFMpegPath = ffMpegPath;_originalFFProbePath = ffProbePath;_originalFFMpegPath = ffMpegPath;-_hasExternalEncoder = hasExternalEncoder;}- private readonly object _logLock = new object();- public void SetLogFilename(string name)- {- lock (_logLock)- {- try- {- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=" + name + ":level=32");- }- catch (Exception ex)- {- _logger.LogError(ex, "Error setting FFREPORT environment variable");- }- }- }-- public void ClearLogFilename()- {- lock (_logLock)- {- try- {- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", null);- }- catch (Exception ex)- {- _logger.LogError(ex, "Error setting FFREPORT environment variable");- }- }- }-public string EncoderLocationType{get@@ -362,7 +327,7 @@ namespace MediaBrowser.MediaEncoding.Encoderprivate Tuple<string, string> GetPathsFromDirectory(string path){- // Since we can't predict the file extension, first try directly within the folder+ // Since we can't predict the file extension, first try directly within the folder// If that doesn't pan out, then do a recursive searchvar files = FileSystem.GetFilePaths(path);@@ -525,7 +490,7 @@ namespace MediaBrowser.MediaEncoding.EncoderCreateNoWindow = true,UseShellExecute = false,- // Must consume both or ffmpeg may hang due to deadlocks. See comments below.+ // Must consume both or ffmpeg may hang due to deadlocks. See comments below.RedirectStandardOutput = true,FileName = FFProbePath,Arguments = string.Format(args, probeSizeArgument, inputPath).Trim(),@@ -648,7 +613,7 @@ namespace MediaBrowser.MediaEncoding.Encodervar tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");FileSystem.CreateDirectory(FileSystem.GetDirectoryName(tempExtractPath));- // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.+ // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff arvar vf = "scale=600:trunc(600/dar/2)*2";@@ -676,7 +641,7 @@ namespace MediaBrowser.MediaEncoding.Encoderbreak;}}-+var mapArg = imageStreamIndex.HasValue ? (" -map 0:v:" + imageStreamIndex.Value.ToString(CultureInfo.InvariantCulture)) : string.Empty;var enableThumbnail = !new List<string> { "wtv" }.Contains(container ?? string.Empty, StringComparer.OrdinalIgnoreCase);diff --git a/MediaBrowser.Model/System/IEnvironmentInfo.cs b/MediaBrowser.Model/System/IEnvironmentInfo.csindex 6af514dc8e..faf9f0a422 100644--- a/MediaBrowser.Model/System/IEnvironmentInfo.cs+++ b/MediaBrowser.Model/System/IEnvironmentInfo.cs@@ -8,10 +8,6 @@ namespace MediaBrowser.Model.Systemstring OperatingSystemName { get; }string OperatingSystemVersion { get; }Architecture SystemArchitecture { get; }- string GetEnvironmentVariable(string name);- void SetProcessEnvironmentVariable(string name, string value);- string StackTrace { get; }- char PathSeparator { get; }}public enum OperatingSystem