feat: 移动文件后更新 media_info 的 file_path 为新路径
This commit is contained in:
@@ -348,7 +348,7 @@ func (s *ScanService) runMove(ctx context.Context) {
|
||||
|
||||
// 执行移动
|
||||
mv := &mover.Mover{}
|
||||
mv.MoveAll(jobs, func(doneCount int) {
|
||||
moved := mv.MoveAll(jobs, func(doneCount int) {
|
||||
s.setProgress(stageMove, doneCount, len(jobs))
|
||||
if ctx.Err() != nil {
|
||||
return
|
||||
@@ -360,6 +360,13 @@ func (s *ScanService) runMove(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新 media_info 中的 file_path 为新路径
|
||||
if len(moved) > 0 {
|
||||
if err := s.store.UpdateMediaFilePaths(moved); err != nil {
|
||||
fmt.Printf("=== 更新媒体文件路径失败: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 移动完成后清空续传记录
|
||||
if err := s.store.ClearScanLog(); err != nil {
|
||||
fmt.Printf("=== 清空续传记录失败: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user