feat(library): implement scanner interface for triggering library scans on create/update

Signed-off-by: Deluan <deluan@navidrome.org>

# Conflicts:
#	cmd/wire_gen.go
#	cmd/wire_injectors.go

# Conflicts:
#	cmd/wire_gen.go

# Conflicts:
#	cmd/wire_gen.go
#	cmd/wire_injectors.go
This commit is contained in:
Deluan 2025-06-24 23:05:39 -04:00
commit 12562dbfab
6 changed files with 186 additions and 29 deletions

View file

@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"net/http/httptest"
"strings"
"github.com/navidrome/navidrome/conf/configtest"
"github.com/navidrome/navidrome/consts"
@ -253,7 +254,7 @@ var _ = Describe("Library API", func() {
}
for _, endpoint := range endpoints {
parts := Split(endpoint, " ")
parts := strings.Split(endpoint, " ")
method, path := parts[0], parts[1]
req := createAuthenticatedRequest(method, path, nil, userToken)
@ -421,17 +422,3 @@ func createUnauthenticatedRequest(method, path string, body *bytes.Buffer) *http
req.Header.Set("Content-Type", "application/json")
return req
}
// Helper function to split strings
func Split(s, sep string) []string {
var result []string
start := 0
for i, r := range s {
if string(r) == sep {
result = append(result, s[start:i])
start = i + 1
}
}
result = append(result, s[start:])
return result
}