feat: OpenSubsonic playlists and listens

Apps can use the playlists of a person and report what they listened to.

- getPlaylists, getPlaylist, createPlaylist (with songs, or in place of an
  existing one), updatePlaylist (name, comment, songs to add, places to remove),
  deletePlaylist: the same playlists as the web app
- scrobble records a complete listen once however many times an app tries
  again, and shares it on Mastodon when the person connected it; a now playing
  message records nothing; getNowPlaying answers with nothing
- README section on connecting other apps
This commit is contained in:
tgiachi 2026-11-16 10:22:11 +01:00
commit a0dc4458ef

View file

@ -304,6 +304,7 @@ func run() error {
deviceSvc := devices.NewService(storage.NewDevicesRepo(db), []byte(cfg.Auth.JWTSecret))
catalogSvc := catalog.NewService(storage.NewCatalogRepo(db))
streamSvc := streaming.NewService(libraryRepo)
listeningSvc := listening.NewService(storage.NewListeningRepo(db), cfg.Listening.MinListen())
subsonicRepo := storage.NewSubsonicRepo(db, cfg.Listening.MinListen())
router := httpapi.NewRouter(httpapi.Deps{
@ -312,12 +313,13 @@ func run() error {
Stats: stats.NewService(storage.NewStatsRepo(db), cfg.Listening.MinListen()),
Auth: auth.NewService(storage.NewUserRepo(db), storage.NewRefreshRepo(db), tokens, cfg.Auth.RefreshTTL()),
Tokens: tokens,
Listening: listening.NewService(storage.NewListeningRepo(db), cfg.Listening.MinListen()),
Listening: listeningSvc,
Mastodon: mastodonSvc,
Devices: deviceSvc,
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,
ServerVersion: version,
},
Scan: scanControl{ctx: ctx, m: scans},