fix: align scraped media naming and release sorting

This commit is contained in:
ShukeBta
2026-07-03 02:55:33 +08:00
parent 78de029ef3
commit b610dda098
48 changed files with 544 additions and 42 deletions
+18
View File
@@ -186,3 +186,21 @@ func (o *OrganizerService) applyOrganizeMedia(ctx context.Context, req organizeM
)
return dst.path, nil
}
func cleanupEmptyOrganizeParents(oldPath, stopRoot string) {
dir := filepath.Clean(filepath.Dir(strings.TrimSpace(oldPath)))
root := filepath.Clean(strings.TrimSpace(stopRoot))
if dir == "" || root == "" || dir == "." || root == "." || !pathWithin(dir, root) {
return
}
for !samePath(dir, root) {
if err := os.Remove(dir); err != nil {
return
}
next := filepath.Dir(dir)
if samePath(next, dir) {
return
}
dir = next
}
}