Skip to content

Commit

Permalink
增加自定义环境变量FFMPEG的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Jul 6, 2024
1 parent 7cd6ffb commit ddbd48e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
21 changes: 21 additions & 0 deletions Core/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,27 @@ public long _AutomaticFileCleaningThreshold
}
}

private static string UsingEnvironmentVariablesFFMPEG = "false";
/// <summary>
/// 是否读取环境变量中的FFMPEG路径(环境变量为"DDTV_FFMPEG",值为FFMPEG可执行程序的完整路径)
/// 默认值:false
/// </summary>
public bool _UsingEnvironmentVariablesFFMPEG
{
get
{
return bool.Parse(UsingEnvironmentVariablesFFMPEG);
}
set
{
if (value.ToString() != UsingEnvironmentVariablesFFMPEG)
{
UsingEnvironmentVariablesFFMPEG = value.ToString();
OnPropertyChanged();
ModifyConfig(value);
}
}
}
}
#endregion
}
Expand Down
7 changes: 6 additions & 1 deletion Core/Tools/Transcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ public async Task TranscodeAsync(string before, string after, RoomCardClass Card
}; // 捕捉的信息
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (File.Exists("./Plugins/ffmpeg/ffmpeg.exe"))
string? path = Environment.GetEnvironmentVariable("DDTV_FFMPEG");
if (Config.Core_RunConfig._UsingEnvironmentVariablesFFMPEG && !string.IsNullOrEmpty(path) && File.Exists(path))
{
process.StartInfo.FileName = path;
}
else if (File.Exists("./Plugins/ffmpeg/ffmpeg.exe"))
{
process.StartInfo.FileName = "./Plugins/ffmpeg/ffmpeg.exe";
}
Expand Down
2 changes: 1 addition & 1 deletion Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void Main(string[] args)
FilePath = FilePath.Replace("bin/", "DDTV/");
}

if (item.FilePath.Contains("bin/Update") || item.FileName.ToLower().Contains("ffmpeg.exe"))
if (item.FilePath.Contains("bin/Update"))
{
FileUpdateStatus = false;
}
Expand Down

0 comments on commit ddbd48e

Please sign in to comment.