Smarter deduplication messages

This commit is contained in:
N00MKRAD
2023-12-21 18:39:52 +01:00
parent 979eca6b50
commit 058820bc8e
2 changed files with 209 additions and 206 deletions

View File

@@ -190,7 +190,7 @@ namespace Flowframes.Magick
foreach (string frame in framesToDelete)
IoUtils.TryDeleteIfExists(frame);
string testStr = testRun ? " [TestRun]" : "";
string testStr = testRun ? "[TESTRUN] " : "";
if (Interpolate.canceled) return;
@@ -199,15 +199,17 @@ namespace Flowframes.Magick
float percentDeleted = ((float)framesDeleted / framePaths.Length) * 100f;
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
Logger.Log($"[Deduplication]{testStr} Done. Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.", false, true);
if (statsFramesKept <= 0)
if (framesDeleted <= 0)
{
Interpolate.Cancel("No frames were left after de-duplication!\n\nTry decreasing the de-duplication threshold.");
Logger.Log($"Deduplication: No duplicate frames detected on this video.", false, true);
}
else if (statsFramesKept <= 0)
{
Interpolate.Cancel("No frames were left after de-duplication!\n\nTry lowering the de-duplication threshold.");
}
else
{
// Interpolate.InterpProgressMultiplier = (framePaths.Length / (float)framesLeft);
Logger.Log($"{testStr}Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.", false, true);
}
}
static float GetDifference(MagickImage img1, MagickImage img2)

View File

@@ -146,12 +146,13 @@ namespace Flowframes
float percentDeleted = ((float)framesDeleted / currentMediaFile.FrameCount) * 100f;
string keptPercent = $"{(100f - percentDeleted).ToString("0.0")}%";
if (framesDeleted > 0)
{
if (QuickSettingsTab.trimEnabled)
Logger.Log($"Deduplication: Kept {framesLeft} frames.");
else
Logger.Log($"Deduplication: Kept {framesLeft} ({keptPercent}) frames, deleted {framesDeleted} frames.");
// InterpProgressMultiplier = (currentMediaFile.FrameCount / (float)framesLeft);
}
}
if (!Config.GetBool("allowConsecutiveSceneChanges", true))