From 23611926ab336540479b27bf9644d77e309245c9 Mon Sep 17 00:00:00 2001
From: barelyprofessional
<150058423+barelyprofessional@users.noreply.github.com>
Date: Mon, 25 Aug 2025 20:49:16 -0500
Subject: [PATCH] Randomize file names due to race condition with PeerTube
---
KfChatDotNetBot/Services/StreamCapture.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/KfChatDotNetBot/Services/StreamCapture.cs b/KfChatDotNetBot/Services/StreamCapture.cs
index e99c3bb..0fbfdc0 100644
--- a/KfChatDotNetBot/Services/StreamCapture.cs
+++ b/KfChatDotNetBot/Services/StreamCapture.cs
@@ -93,8 +93,9 @@ public class StreamCapture(string streamUrl, StreamCaptureMethods captureMethod,
/// Thrown if the operating system is unsupported (i.e. not Windows, Linux or FreeBSD
private async Task CreateScriptAsync()
{
+ var random = Convert.ToHexString(Guid.NewGuid().ToByteArray()[..4]);
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())
{
Path.ChangeExtension(scriptPath, ".bat");