refactor: 按模块重构项目结构
- 删除 vars 全局状态,按职责拆分 internal/ 包:scanner/probe/classify/organize/mover/store/digest - 数据驱动归类规则替代图片/视频重复分支,store 改为结构体实例 - build.sh 按系统类型编译:Windows 用 upx 压缩,macOS/Linux 不压缩 - 忽略目录拆分:图片_已忽略 / 视频_已忽略 - 输出构建产物加入 .gitignore
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package probe
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"golang.org/x/image/webp"
|
||||
)
|
||||
|
||||
// probeWebp 读取 WebP 图片宽高(只解码配置,不加载完整像素数据)
|
||||
func probeWebp(filePath string) (*ProbeResult, error) {
|
||||
f, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer f.Close()
|
||||
cfg, err := webp.DecodeConfig(f)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("decode webp: %w", err)
|
||||
}
|
||||
return &ProbeResult{Width: cfg.Width, Height: cfg.Height}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user