feat(api): rewrite /api/radio with weighted shuffle v1

Validates seed_track + optional limit (default cfg.Recommendation.RadioSize,
clamped to RadioSizeMax). Calls recommendation.LoadCandidates +
recommendation.Shuffle. Prepends seed to result. Server seeds a
math/rand source at startup; handlers package threads that as a
func() float64 so tests inject deterministic RNGs.

Mount + server.New gain a RecommendationConfig parameter.
This commit is contained in:
2026-04-27 08:08:10 -04:00
parent 9426dc2eeb
commit 08591debee
8 changed files with 186 additions and 82 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ func run() error {
srv := server.New(logger, pool, scanner, subsonic.Config{
AllowPlaintextPassword: cfg.Subsonic.AllowPlaintextPassword,
}, cfg.Events)
}, cfg.Events, cfg.Recommendation)
httpServer := &http.Server{
Addr: cfg.Server.Address,
Handler: srv.Router(),