增加`RE_LIVE_PIPE_TMP_DIR`环境变量读取 #162

This commit is contained in:
nilaoda 2023-11-13 22:37:24 +08:00
parent 7983e2c340
commit 8fdb6bc90b
3 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@ namespace N_m3u8DL_RE.CommandLine
{
internal partial class CommandInvoker
{
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20231026";
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20231113";
[GeneratedRegex("((best|worst)\\d*|all)")]
private static partial Regex ForStrRegex();

View File

@ -160,5 +160,10 @@ namespace N_m3u8DL_RE.Util
if (File.Exists(deGzipFile)) File.Delete(deGzipFile);
}
}
public static string GetEnvironmentVariable(string key, string defaultValue = "")
{
return Environment.GetEnvironmentVariable(key) ?? defaultValue;
}
}
}

View File

@ -54,7 +54,8 @@ namespace N_m3u8DL_RE.Util
string dateString = DateTime.Now.ToString("o");
StringBuilder command = new StringBuilder("-y -fflags +genpts -loglevel quiet ");
string? customDest = Environment.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");
string customDest = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");
string pipeDir = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_TMP_DIR", Path.GetTempPath());
if (!string.IsNullOrEmpty(customDest))
{
@ -67,7 +68,7 @@ namespace N_m3u8DL_RE.Util
command.Append($" -i \"\\\\.\\pipe\\{item}\" ");
else
//command.Append($" -i \"unix://{Path.Combine(Path.GetTempPath(), $"CoreFxPipe_{item}")}\" ");
command.Append($" -i \"{Path.Combine(Path.GetTempPath(), item)}\" ");
command.Append($" -i \"{Path.Combine(pipeDir, item)}\" ");
}
for (int i = 0; i < pipeNames.Length; i++)