fix: 重复文件归类、图片探测与明暗分析健壮性
- organize/store: 按 MD5 去重,重复图片/视频/音频统一移入「重复文件」目录,不再覆盖已有记录 - probe/image: webp/bmp/psd/psb 专用解码失败后走 ffprobe 兜底,与通用路径一致 - probe/brightness: 大图内存缩放为缩略图再分析明暗,超4000万像素跳过分析防OOM - README: 补充重复文件目录说明,修正 Go 版本为 1.25.0
This commit is contained in:
@@ -104,6 +104,19 @@ func (s *Store) FindMediaByFingerprint(size int64, headMd5, tailMd5 string) (*Me
|
||||
return info, true
|
||||
}
|
||||
|
||||
// FindMediaByMd5 按文件MD5查找已入库记录(用于识别重复文件)
|
||||
func (s *Store) FindMediaByMd5(md5 string) (*MediaInfo, bool) {
|
||||
if s == nil || s.engine == nil || md5 == "" {
|
||||
return nil, false
|
||||
}
|
||||
info := new(MediaInfo)
|
||||
has, err := s.engine.Where("file_md5 = ?", md5).Get(info)
|
||||
if err != nil || !has {
|
||||
return nil, false
|
||||
}
|
||||
return info, true
|
||||
}
|
||||
|
||||
// UpdateMediaDest 按源路径回填文件的归类目录与去向
|
||||
func (s *Store) UpdateMediaDest(filePath, destDir string) error {
|
||||
if s == nil || s.engine == nil {
|
||||
|
||||
Reference in New Issue
Block a user