Skip to content

Commit bc89f9c

Browse files
committed
av1an: Get scene count from log instead of stdout, allows for prog bar with visible cmd
1 parent 5c52638 commit bc89f9c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ff-utils-winforms/Media/Av1anOutputHandler.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public static void LogOutput(string line, string logFilename, LogMode logMode, b
3737

3838
if (line.StartsWith("Queue: "))
3939
TryParseQueueSize(line);
40-
40+
else if (line.Contains("SC: Now at "))
41+
currentQueueSize = line.Split("SC: Now at ")[1].Split(' ')[0].GetInt();
4142

4243
if (line.Contains("Could not open file"))
4344
{
@@ -91,6 +92,12 @@ public static async Task ParseProgressLoop()
9192
string[] logLines = contents.SplitIntoLines();
9293
int encodedChunks = logLines.Where(x => x.Contains("Done: ")).Count();
9394

95+
if(currentQueueSize == 0)
96+
{
97+
string[] sc = logLines.Where(x => x.Contains("SC: Now at ")).ToArray();
98+
currentQueueSize = sc.Length > 0 ? sc[0].Split("SC: Now at ")[1].Split(' ')[0].GetInt() : 0;
99+
}
100+
94101
int ratio = FormatUtils.RatioInt(encodedChunks, currentQueueSize);
95102
Program.mainForm.SetProgress(ratio);
96103

@@ -121,7 +128,6 @@ public static async Task ParseProgressLoop()
121128
{
122129
Logger.Log($"Failed to get av1an progress from log file: {e.Message}\n{e.StackTrace}", true);
123130

124-
125131
for (int i = 100; i > 0; i--)
126132
{
127133
if (!Program.busy) return;

0 commit comments

Comments
 (0)