feat: radio stations that Sonda makes by itself

Stations made from the music, random and without end, with nothing to set up: the
mixes the listener has (genres, favourites, rediscover, new to you), everything,
one for each decade that has 30 songs by 4 artists, and the radio of an artist (their
songs, four times as likely, and the songs of the two genres most of theirs have).
Every time a station is asked for it picks other songs, with the same weights as the
mixes (taste, hearts, nothing skipped lately).

- mixes.Service.Radios and Radio; Filter has All and years, the store has Decades
- GET /radio and GET /radio/{id}, in the OpenAPI spec
- OpenSubsonic: each station is a playlist (rd-<id>, "Radio · Rock") that has other
  songs every time it is opened, for apps that cannot play a radio that never ends
This commit is contained in:
tgiachi 2026-11-16 12:13:55 +01:00
commit 407b20334a

View file

@ -305,6 +305,7 @@ func run() error {
deviceSvc := devices.NewService(storage.NewDevicesRepo(db), []byte(cfg.Auth.JWTSecret))
catalogSvc := catalog.NewService(storage.NewCatalogRepo(db))
streamSvc := streaming.NewService(libraryRepo)
mixSvc := mixes.NewService(storage.NewMixRepo(db), tasteService, cfg.Listening.MinListen())
favoriteSvc := favorites.NewService(storage.NewFavoritesRepo(db), catalogSvc)
listeningSvc := listening.NewService(storage.NewListeningRepo(db), cfg.Listening.MinListen())
subsonicRepo := storage.NewSubsonicRepo(db, cfg.Listening.MinListen())
@ -322,7 +323,7 @@ func run() error {
OpenSubsonic: &opensubsonic.Deps{
Login: deviceSvc, Catalog: catalogSvc, Libraries: libraries,
Extras: subsonicRepo, Lists: subsonicRepo, Streams: streamSvc, Covers: pictures, ArtistImages: pictures,
Playlists: playlistSvc, Listens: listeningSvc, Announcer: mastodonSvc, Favorites: favoriteSvc,
Playlists: playlistSvc, Listens: listeningSvc, Announcer: mastodonSvc, Favorites: favoriteSvc, Radio: mixSvc,
ServerVersion: version,
},
Scan: scanControl{ctx: ctx, m: scans},
@ -340,7 +341,7 @@ func run() error {
Playlists: playlistSvc,
Suggestions: affinity.NewService(affinityRepo, affinityRepo, feedbacks, affinityRepo, userSettings, cfg.Listening.MinListen()),
SpotifyImport: spotifyimport.NewService(storage.NewCatalogRepo(db), storage.NewListeningRepo(db), playlistSvc, storage.NewSpotifyImportRepo(db), storage.NewOutsidePlayRepo(db), storage.SearchKey, cfg.Listening.MinListen()),
Mixes: mixes.NewService(storage.NewMixRepo(db), tasteService, cfg.Listening.MinListen()),
Mixes: mixSvc,
Smart: smart.NewService(storage.NewSmartRepo(db), tasteService, cfg.Listening.MinListen()),
Naming: namingService,
Images: pictures,