Merge pull request #516 from Bond-009/env
Remove useless properties from IEnvironmentInfo
This commit is contained in:
commit
3d867c2c46
|
@ -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,7 +118,10 @@ namespace IsoMounter
|
|||
public bool CanMount(string path)
|
||||
{
|
||||
|
||||
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux) {
|
||||
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,
|
||||
|
@ -128,15 +131,14 @@ namespace IsoMounter
|
|||
ExecutablesAvailable.ToString()
|
||||
);
|
||||
|
||||
if (ExecutablesAvailable) {
|
||||
if (ExecutablesAvailable)
|
||||
{
|
||||
return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Task Install(CancellationToken cancellationToken)
|
||||
|
@ -211,18 +213,16 @@ namespace IsoMounter
|
|||
private 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()
|
||||
|
|
|
@ -1188,8 +1188,7 @@ namespace Emby.Server.Implementations
|
|||
HttpClient,
|
||||
ZipClient,
|
||||
ProcessFactory,
|
||||
5000,
|
||||
EnvironmentInfo);
|
||||
5000);
|
||||
|
||||
MediaEncoder = mediaEncoder;
|
||||
RegisterSingleInstance(MediaEncoder);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using MediaBrowser.Model.System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Emby.Server.Implementations.EnvironmentInfo
|
||||
{
|
||||
// TODO: Rework @bond
|
||||
public 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
private 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.Encoder
|
|||
IHttpClient 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
|
||||
|
|
|
@ -8,10 +8,6 @@ namespace MediaBrowser.Model.System
|
|||
string 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
|
||||
|
|
Loading…
Reference in New Issue
Block a user