mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-16 02:52:44 -04:00
Randomize file names due to race condition with PeerTube
This commit is contained in:
@@ -93,8 +93,9 @@ public class StreamCapture(string streamUrl, StreamCaptureMethods captureMethod,
|
|||||||
/// <exception cref="UnsupportedOperatingSystemException">Thrown if the operating system is unsupported (i.e. not Windows, Linux or FreeBSD</exception>
|
/// <exception cref="UnsupportedOperatingSystemException">Thrown if the operating system is unsupported (i.e. not Windows, Linux or FreeBSD</exception>
|
||||||
private async Task<string> CreateScriptAsync()
|
private async Task<string> CreateScriptAsync()
|
||||||
{
|
{
|
||||||
|
var random = Convert.ToHexString(Guid.NewGuid().ToByteArray()[..4]);
|
||||||
var scriptPath = Path.Join(_settings[BuiltIn.Keys.CaptureYtDlpScriptPath].Value,
|
var scriptPath = Path.Join(_settings[BuiltIn.Keys.CaptureYtDlpScriptPath].Value,
|
||||||
$"bot_ytdlp_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}.sh");
|
$"bot_ytdlp_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}_{random}.sh");
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
Path.ChangeExtension(scriptPath, ".bat");
|
Path.ChangeExtension(scriptPath, ".bat");
|
||||||
|
|||||||
Reference in New Issue
Block a user