refactor: 移除 nsfw.python 配置项,自动在 PATH 中查找 python

This commit is contained in:
2025-09-07 21:09:43 +08:00
parent b601f9b0b5
commit dd2bb8fd50
3 changed files with 11 additions and 54 deletions
+2 -3
View File
@@ -674,7 +674,6 @@ func (s *ScanService) runScan(ctx context.Context, rootDir, destDir string) erro
// ---------- 第五步(可选):色情识别 ----------
// 从数据库读取 NSFW 配置(支持运行时修改,立即生效)
nsfwType := s.store.GetConfig("nsfw.type") // "" / "human" / "anime"
pythonPath := config.GetAppConfig().NSFWPython
nsfwDet := (*nsfw.Detector)(nil)
s.setNsfwDetectorReady(false)
@@ -685,7 +684,7 @@ func (s *ScanService) runScan(ctx context.Context, rootDir, destDir string) erro
threshold = t
}
}
if d, err := nsfw.Start(pythonPath, threshold); err != nil {
if d, err := nsfw.Start("", threshold); err != nil {
fmt.Printf("=== 色情识别未启用(图片照常处理): %v\n", err)
} else {
nsfwDet = d
@@ -704,7 +703,7 @@ func (s *ScanService) runScan(ctx context.Context, rootDir, destDir string) erro
threshold = t
}
}
if d, err := anime_nsfw.Start(pythonPath, threshold); err != nil {
if d, err := anime_nsfw.Start("", threshold); err != nil {
fmt.Printf("=== 动漫色情识别未启用(图片照常处理): %v\n", err)
} else {
animeNsfwDet = d