From 8fdb6bc90ba128b91bff32d32ed6152f88584374 Mon Sep 17 00:00:00 2001 From: nilaoda Date: Mon, 13 Nov 2023 22:37:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`RE=5FLIVE=5FPIPE=5FTMP=5FDIR?= =?UTF-8?q?`=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E8=AF=BB=E5=8F=96=20#162?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs | 2 +- src/N_m3u8DL-RE/Util/OtherUtil.cs | 5 +++++ src/N_m3u8DL-RE/Util/PipeUtil.cs | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs index b200b56..2237d02 100644 --- a/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs +++ b/src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs @@ -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(); diff --git a/src/N_m3u8DL-RE/Util/OtherUtil.cs b/src/N_m3u8DL-RE/Util/OtherUtil.cs index cce15b2..1a60ca9 100644 --- a/src/N_m3u8DL-RE/Util/OtherUtil.cs +++ b/src/N_m3u8DL-RE/Util/OtherUtil.cs @@ -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; + } } } diff --git a/src/N_m3u8DL-RE/Util/PipeUtil.cs b/src/N_m3u8DL-RE/Util/PipeUtil.cs index 0a3fd93..d51df0e 100644 --- a/src/N_m3u8DL-RE/Util/PipeUtil.cs +++ b/src/N_m3u8DL-RE/Util/PipeUtil.cs @@ -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++)