feat(subsonic): playlists and daily mixes, the weighted shuffle, and radio
release / go (push) Successful in 2m0s
release / web (push) Successful in 1m23s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 4m23s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 2m8s
release / android (push) Canceled after 3m38s
release / go (push) Successful in 2m0s
release / web (push) Successful in 1m23s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 4m23s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 2m8s
release / android (push) Canceled after 3m38s
Subsonic apps now get what Minstrel picks, not only what it holds: - getPlaylists lists the listener's daily mixes first, then their own playlists, then other people's public ones; getPlaylist returns the playable songs in order, as <entry> elements in XML. - getRandomSongs answers with the weighted shuffle (likes up, skips down, the last hour's plays out), narrowed by genre and release year. - getSimilarSongs and getSimilarSongs2 answer with Minstrel's radio, seeded from a song, or from a random song of an album or artist. Radio's selection moves out of the /api/radio handler into recommendation.Picker, built by recsettings.Service.Picker, so the web and Android apps and the Subsonic apps pick through one piece of code and one tuning. SongRef loses its XMLName so the field holding it names the element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user