Find and remove duplicate songs within the slave library

A new Duplicates filter in Review finds songs filed more than once in the
slave library, such as a single next to its album version, and recommends
which copy to keep. Removed copies go to the quarantine and can be restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-09-30 19:44:03 -07:00
1 parent 491d679233
commit 206b2ab5db
13 files changed
+1123 -11

No files matched your search

+35
View File
@@ -105,6 +105,9 @@ func (s *Server) Handler() http.Handler {
r.Get("/empty-folders", s.handleEmptyFolders)
r.Post("/empty-folders/scan", s.handleEmptyFolderScan)
r.Post("/empty-folders/remove", s.handleRemoveEmptyFolders)
r.Get("/duplicates", s.handleDupes)
r.Post("/duplicates/scan", s.handleDupeScan)
r.Post("/duplicates/remove", s.handleRemoveDupes)
r.Post("/build", s.handleBuild)
r.Post("/remove", s.handleRemove)
})
@@ -797,6 +800,38 @@ var audioTypes = map[string]string{
}
// handleListen streams a song with range support, so the browser can seek.
func (s *Server) handleDupes(w http.ResponseWriter, r *http.Request) {
id, _ := idParam(r)
writeJSON(w, 200, map[string]any{"scan": s.eng.DupeResult(id), "dry_run": s.st.DryRun(r.Context())})
}
func (s *Server) handleDupeScan(w http.ResponseWriter, r *http.Request) {
id, _ := idParam(r)
j, err := s.eng.StartDupeScan(id)
if err != nil {
opErr(w, err)
return
}
writeJSON(w, 202, j)
}
func (s *Server) handleRemoveDupes(w http.ResponseWriter, r *http.Request) {
id, _ := idParam(r)
var body struct {
Files []string `json:"files"` // must come from the latest search
}
if !readJSON(w, r, &body) {
return
}
if !s.preAction(w, r, id, "remove duplicate songs") {
return
}
j, err := s.eng.StartRemoveDupes(id, body.Files)
if err != nil {
opErr(w, err)
return
}
s.log.Info("removing duplicate songs", "pair", id, "files", len(body.Files))
writeJSON(w, 202, j)
}
func (s *Server) handleListen(w http.ResponseWriter, r *http.Request) {
id, _ := idParam(r)
q := r.URL.Query()