Repository navigation
Conversation
Author
|
问题部分已修改 |
Author
|
不好意思,检查了一下发现格式有问题,已经改正了 |
Owner
|
mark,有空看看 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
目前添加目录后会递归扫描目录下的所有子文件夹,无法只挑其中几个。例如一个媒体库目录里既有想收录的番号文件夹,也有临时目录、其它类型的片子,只能整库扫描后再逐个排除。
这个 PR 增加"选择目录时可以只扫描其中部分子文件夹"的能力。使用AI辅助生成,如果大佬不认可的话可以跟我说,我这边直接关闭。
改动
交互
DirectoryPickerModal)新增selectSubdirectories模式:每个子文件夹左侧有勾选框,可以边浏览边勾选,底部实时显示"只扫描:A / B",按钮显示已选数量。DownloaderSettingsView)没有开启该模式,行为不受影响。后端
directory.scan_scope列(迁移202611010001_add_directory_scan_scope.go),存{"include":["A","B"]},默认{}表示全部扫描,老数据无感升级。models.DirectoryScanScope:JSON 列,Includes()负责归一化。db.normalizeDirectoryScanScope:校验每个选项必须是目录内的相对路径且真实存在,拒绝..、绝对路径、普通文件;嵌套选择自动收敛到父级,避免重复扫描。db.CreateDirectoryWithScope/db.UpdateDirectoryWithScope:原CreateDirectory/UpdateDirectory保留为薄封装,调用方无需改动。directory.walkAndReconcileVideoFiles:改为按选中的子目录逐个WalkDir,文件位置仍然相对目录根,因此播放、缩略图、JAV 关联、删除清理逻辑都不受影响。POST /directories、PATCH /directories/:id支持scan_include: ["A","B"];改范围会和改路径一样等正在进行的扫描结束,然后重新扫描。兼容性
scan_include时行为与改动前完全一致。测试
internal/db/directory_scan_scope_test.go:范围归一化、拒绝越界路径、保存/清空。internal/directory/directory_scan_scope_test.go:遍历根计算、嵌套收敛、越界拒绝。internal/api/directory_scan_scope_api_test.go:创建/更新接口的scan_include契约。web/tests/features/directories/directoryScanScope.test.js:勾选 UI 与参数传递。files_seen: 2;改勾 A+B →files_seen: 3。本地已通过
go build ./...、go test ./internal/db/... ./internal/directory/... ./internal/api/ -run 'Directory|ScanScope'、npm run lint、npm run format:check、npm run build。