From 21796d79b698a23ca1fc0e1787d2879e7764790f Mon Sep 17 00:00:00 2001 From: xiangbing Date: Sat, 10 Jan 2026 19:26:09 +0800 Subject: [PATCH] update --- ViewModels/ExtractWindowViewModel.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ViewModels/ExtractWindowViewModel.cs b/ViewModels/ExtractWindowViewModel.cs index 1bba37b..425c4d1 100644 --- a/ViewModels/ExtractWindowViewModel.cs +++ b/ViewModels/ExtractWindowViewModel.cs @@ -1,4 +1,4 @@ -using FFMpegCore; +using FFMpegCore; using FFMpegCore.Enums; using Microsoft.Expression.Drawing.Core; using System.IO; @@ -125,9 +125,10 @@ namespace VideoConcat.ViewModels string originalFileName = Path.GetFileNameWithoutExtension(currentVideo); string extension = Path.GetExtension(currentVideo); - // 生成唯一的文件名:原文件名_序号_方案.扩展名 + // 生成唯一的文件名:原始名称+方案号+生成日期+序号 string modeSuffix = ExtractWindowModel.ExtractFrameMode == Models.ExtractFrameMode.DeleteFrame ? "方案1" : "方案2"; - string _tmpFileName = $"{originalFileName}_{currentIndex:D4}_{modeSuffix}{extension}"; + string dateStr = DateTime.Now.ToString("yyyyMMdd"); + string _tmpFileName = $"{originalFileName}_{modeSuffix}_{dateStr}_{currentIndex:D4}{extension}"; string outPath = Path.Combine(_tmpPath, "out"); LogUtils.Info($"准备创建输出目录:{outPath}"); @@ -208,8 +209,7 @@ namespace VideoConcat.ViewModels if (totalDuration < 20 && ExtractWindowModel.ExtractFrameMode == Models.ExtractFrameMode.DeleteFrame) { - string videoName = Path.GetFileName(currentVideo); - string errorMsg = $"视频时长太短:{videoName}({totalDuration:F2}秒),需要至少20秒"; + string errorMsg = $"视频时长太短:{currentVideo}({totalDuration:F2}秒),需要至少20秒"; LogUtils.Error(errorMsg); errorMessages.Add(errorMsg); @@ -291,7 +291,7 @@ namespace VideoConcat.ViewModels string outputSizeStr = $"{outputMB:F2}MB"; string durationStr = $"{taskDuration.TotalSeconds:F1}s"; - successMessages.Add($"{originalFileName} (第{currentIndex}个) - 成功"); + successMessages.Add($"{currentVideo} (第{currentIndex}个) - 成功"); LogUtils.Info($"处理成功:{currentVideo} -> {outputPath}, 大小={outputMB:F2}MB, 耗时={taskDuration.TotalSeconds:F2}秒"); // 更新表格行 @@ -315,7 +315,7 @@ namespace VideoConcat.ViewModels else if (success) { LogUtils.Warn($"处理返回成功但文件不存在:{outputPath}"); - string errorMsg = $"{originalFileName} (第{currentIndex}个) - 返回成功但文件不存在"; + string errorMsg = $"{currentVideo} (第{currentIndex}个) - 返回成功但文件不存在"; errorMessages.Add(errorMsg); ExtractWindowModel.Dispatcher.Invoke(() => @@ -337,7 +337,7 @@ namespace VideoConcat.ViewModels } else { - string errorMsg = $"{originalFileName} (第{currentIndex}个) - 处理失败"; + string errorMsg = $"{currentVideo} (第{currentIndex}个) - 处理失败"; LogUtils.Error($"{errorMsg} -> {outputPath}"); errorMessages.Add(errorMsg); @@ -363,8 +363,7 @@ namespace VideoConcat.ViewModels { // 在异常处理中重新获取文件名等信息 string originalFileNameForError = Path.GetFileNameWithoutExtension(currentVideo); - string videoName = Path.GetFileName(currentVideo); - string errorMsg = $"抽帧异常:{videoName} (第{currentIndex}个) - {ex.Message}"; + string errorMsg = $"抽帧异常:{currentVideo} (第{currentIndex}个) - {ex.Message}"; LogUtils.Error($"抽帧失败:{currentVideo} (第{currentIndex}个)", ex); errorMessages.Add(errorMsg); @@ -374,13 +373,14 @@ namespace VideoConcat.ViewModels string displayFileNameForError = originalFileNameForError.Length > 15 ? originalFileNameForError.Substring(0, 12) + "..." : originalFileNameForError.PadRight(15); string modeSuffixForError2 = ExtractWindowModel.ExtractFrameMode == Models.ExtractFrameMode.DeleteFrame ? "方案1" : "方案2"; + string dateStrForError2 = DateTime.Now.ToString("yyyyMMdd"); ExtractWindowModel.Dispatcher.Invoke(() => { var taskItem = new Models.ExtractTaskItem { Index = currentIndex.ToString(), FileName = displayFileNameForError, - FullFileName = $"{originalFileNameForError}_{currentIndex:D4}_{modeSuffixForError2}{Path.GetExtension(currentVideo)}", + FullFileName = $"{originalFileNameForError}_{modeSuffixForError2}_{dateStrForError2}_{currentIndex:D4}{Path.GetExtension(currentVideo)}", Status = "异常", OriginalSize = "--", OutputSize = "--",