Skip to content

Commit 8a33e30

Browse files
committed
av1an: Delete temp folder without asking if it doesn't have scene detection data
1 parent d4165bc commit 8a33e30

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ff-utils-winforms/UI/Tasks/Av1anUi.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,17 @@ public static void AskDeleteTempFolder (string dir)
327327
if (string.IsNullOrWhiteSpace(dir))
328328
return;
329329

330+
int minKbytes = 4; // If the temp folder is smaller than this, delete it without asking
330331
var dirSize = IoUtils.GetDirSize(dir, true);
331-
DialogResult dialog = MessageBox.Show($"Do you want to delete the temporary folder ({FormatUtils.Bytes(dirSize)}) of this encode?", "Delete temp folder?", MessageBoxButtons.YesNo);
332+
333+
if (!Directory.Exists(Path.Combine(dir, "split")) || !File.Exists(Path.Combine(dir, "scenes.json")) || dirSize < minKbytes * 1024)
334+
{
335+
Logger.Log($"Temp folder has no scene detection data or is <{minKbytes}kb, deleting without asking");
336+
IoUtils.TryDeleteIfExists(dir);
337+
return;
338+
}
339+
340+
DialogResult dialog = MessageBox.Show($"Av1an has finished.\nDo you want to delete the temporary folder ({FormatUtils.Bytes(dirSize)}) of this encode?", "Delete av1an temp folder?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
332341

333342
if (dialog == DialogResult.Yes)
334343
IoUtils.TryDeleteIfExists(dir);

0 commit comments

Comments
 (0)