fix media organize and subscription workflows

This commit is contained in:
ShukeBta
2026-06-30 20:18:02 +08:00
parent b41f62d572
commit 941bb273b9
107 changed files with 5420 additions and 526 deletions
@@ -39,6 +39,7 @@ func (o *OrganizerService) reclassifyExistingMedia(ctx context.Context, req orga
return false, nil
}
candidates := reclassifyExistingCandidates(req.Existing, target, req.DestRoot)
candidates = reclassifyMoveCandidates(candidates, target)
if len(candidates) == 0 {
return false, nil
}
@@ -112,6 +113,22 @@ func reclassifyExistingCandidates(existing []string, target, destRoot string) []
return out
}
func reclassifyMoveCandidates(existing []string, target string) []string {
targetDir := filepath.Clean(filepath.Dir(target))
out := make([]string, 0, len(existing))
for _, path := range existing {
cleaned := filepath.Clean(strings.TrimSpace(path))
if cleaned == "" || cleaned == "." {
continue
}
if strings.EqualFold(filepath.Clean(filepath.Dir(cleaned)), targetDir) {
continue
}
out = append(out, cleaned)
}
return out
}
func (o *OrganizerService) cleanupReclassifiedDuplicates(ctx context.Context, req organizeExistingReclassifyRequest, target string, candidates []string) (int, error) {
cleaned := 0
for _, oldPath := range candidates {