fix: 修复媒体整理中的文件覆盖、BMP解析与重复整理问题

- 移动文件改用 uuid+原文件名,避免同名覆盖丢失数据
- BMP 负高度取绝对值,自顶向下格式解析正确
- 新增 {目录名}-picker 白名单输出目录,整理后跳过重复扫描
- 分类目录名去掉 uuid 前缀,重复运行并入已有目录
This commit is contained in:
2025-03-15 21:17:24 +08:00
parent 0ebd84d3fe
commit f5e3f6b4ef
8 changed files with 239 additions and 135 deletions
+6 -4
View File
@@ -3,13 +3,16 @@ package util
import (
"bytes"
"fmt"
"github.com/redmask-hb/GoSimplePrint/goPrint"
"io"
"math"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"github.com/redmask-hb/GoSimplePrint/goPrint"
uuid "github.com/satori/go.uuid"
)
var supportVideoTypes = []string{
@@ -148,10 +151,9 @@ func DoMoveFileToDir(filePathList []string, videoDirPath string) {
bar.PrintEnd("=== Finish")
}
// 移动文件到目录,跨文件系统时自动 fallback 为 copy+delete
// 移动文件到目录,跨文件系统时自动 fallback 为 copy+delete,目标文件名使用 uuid+原文件名防止同名覆盖
func moveFileToDir(sourceFilePath string, targetDirectory string) bool {
splits := strings.Split(sourceFilePath, string(os.PathSeparator))
fileName := splits[len(splits)-1]
fileName := strings.ReplaceAll(uuid.NewV4().String(), "-", "") + "_" + filepath.Base(sourceFilePath)
targetFilePath := targetDirectory + fileName
err := os.Rename(sourceFilePath, targetFilePath)
if err == nil {