feat: add image folder scanning and safe output filename

- scan_image_folder(): recursively scans a directory for supported
  images (png/jpg/jpeg/webp, case-insensitive), returns List[ImageAsset],
  skips and logs unsupported files, raises OSError on bad path
- make_safe_output_path(): builds <garment>_<print>.<ext> filename,
  appends _1/_2/... counter if destination already exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 16:58:44 +08:00
co-authored by Claude Sonnet 4.6
parent b692e3aa42
commit 2d9121e3e0
2 changed files with 76 additions and 12 deletions
+11 -11
View File
@@ -160,20 +160,20 @@
任务:
- [ ] 先读取 `src/services/file_service.py` 现有内容
- [ ] 完善 `src/services/file_service.py`
- [ ] 支持递归扫描衣服图片文件夹
- [ ] 支持递归扫描印花图片文件夹
- [ ] 支持格式:PNG、JPG、JPEG、WEBP
- [ ] 忽略不支持格式并记录日志
- [ ] 保留来源子文件夹信息
- [ ] 生成安全输出文件名
- [x] 先读取 `src/services/file_service.py` 现有内容
- [x] 完善 `src/services/file_service.py`
- [x] 支持递归扫描衣服图片文件夹
- [x] 支持递归扫描印花图片文件夹
- [x] 支持格式:PNG、JPG、JPEG、WEBP
- [x] 忽略不支持格式并记录日志
- [x] 保留来源子文件夹信息
- [x] 生成安全输出文件名
验收:
- [ ] 可以扫描包含子文件夹的中文路径
- [ ] 不修改原始素材文件
- [ ] 不支持文件格式不会导致扫描失败
- [x] 可以扫描包含子文件夹的中文路径
- [x] 不修改原始素材文件
- [x] 不支持文件格式不会导致扫描失败
## 4. 模板服务