Skip to content

Commit d4165bc

Browse files
committed
av1an: Clear out done.json when using "Delete, keep scene detection data"
1 parent b812d9f commit d4165bc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ff-utils-winforms/Forms/Av1anResumeForm.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Nmkoder.Data;
22
using Nmkoder.Data.Ui;
3+
using Nmkoder.Extensions;
34
using Nmkoder.IO;
45
using System;
56
using System.Collections.Generic;
@@ -97,7 +98,26 @@ private void DeleteChunks_Click(object sender, EventArgs e)
9798
return;
9899

99100
Av1anFolderEntry entry = (Av1anFolderEntry)folderList.SelectedItem;
100-
IoUtils.DeleteIfExists(Path.Combine(entry.DirInfo.FullName, "encode"));
101+
IoUtils.DeleteContentsOfDir(Path.Combine(entry.DirInfo.FullName, "encode"));
102+
103+
string doneJsonPath = Path.Combine(entry.DirInfo.FullName, "done.json");
104+
105+
if (File.Exists(doneJsonPath))
106+
{
107+
string doneJsonContent = File.ReadAllText(doneJsonPath);
108+
109+
try
110+
{
111+
string before = doneJsonContent.Split("\"done\":{")[0] + "\"done\":{";
112+
string after = "},\"audio_done\"" + doneJsonContent.Split("},\"audio_done\"")[1];
113+
string newDoneJsonContent = before + after;
114+
File.WriteAllText(doneJsonPath, newDoneJsonContent);
115+
}
116+
catch (Exception ex)
117+
{
118+
Logger.Log($"Warning: Failed to reset done.json progress file: {ex.Message}");
119+
}
120+
}
101121
}
102122
catch (Exception ex)
103123
{

0 commit comments

Comments
 (0)