package recsettings import ( "log/slog" "git.fabledsword.com/bvandeusen/minstrel/internal/recommendation" ) // PickerConfig is what a Picker needs beyond the tuning this service holds. type PickerConfig struct { RecentlyPlayedHours int MaxLength int Rand func() float64 LibrarySize *recommendation.LibrarySize Logger *slog.Logger } // Picker returns the chooser behind radio and the weighted shuffle, scored by // the live radio tuning. Minstrel's API and the Subsonic API both build theirs // here, so the two pick alike. A nil service scores with the shipped radio // weights. func (s *Service) Picker(cfg PickerConfig) *recommendation.Picker { return &recommendation.Picker{ Weights: func() recommendation.ScoringWeights { if s == nil { return ShippedRadioWeights() } return s.Weights(ScopeRadio) }, Rand: cfg.Rand, RecentlyPlayedHours: cfg.RecentlyPlayedHours, MaxLength: cfg.MaxLength, LibrarySize: cfg.LibrarySize, Logger: cfg.Logger, } }