feat: favourites of songs, albums and artists, in the API and in apps

A person can mark songs, albums and artists as favourites. They are theirs
alone: never shown to a friend, never sent anywhere. Only what can be played is
listed.

- migration 0035 favorites, internal/favorites, storage.FavoritesRepo
- PUT/DELETE /me/favorites/{kind}/{id}, GET /me/favorites/{kind} and
  GET /me/favorites/ids, in the OpenAPI spec
- catalog.Filter IDs now also reads artists by id
- OpenSubsonic: star, unstar, getStarred2, the starred date on songs, albums and
  artists, and getAlbumList2 of type starred
This commit is contained in:
tgiachi 2026-11-16 10:51:07 +01:00
commit 74f683d26e

View file

@ -25,6 +25,7 @@ import (
"git.kmalloc.org/squid/sonda/internal/discover"
"git.kmalloc.org/squid/sonda/internal/discovery"
"git.kmalloc.org/squid/sonda/internal/duplicates"
"git.kmalloc.org/squid/sonda/internal/favorites"
"git.kmalloc.org/squid/sonda/internal/federation"
"git.kmalloc.org/squid/sonda/internal/feedback"
"git.kmalloc.org/squid/sonda/internal/images"
@ -304,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)
favoriteSvc := favorites.NewService(storage.NewFavoritesRepo(db), catalogSvc)
listeningSvc := listening.NewService(storage.NewListeningRepo(db), cfg.Listening.MinListen())
subsonicRepo := storage.NewSubsonicRepo(db, cfg.Listening.MinListen())
@ -316,10 +318,11 @@ func run() error {
Listening: listeningSvc,
Mastodon: mastodonSvc,
Devices: deviceSvc,
Favorites: favoriteSvc,
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,
Playlists: playlistSvc, Listens: listeningSvc, Announcer: mastodonSvc, Favorites: favoriteSvc,
ServerVersion: version,
},
Scan: scanControl{ctx: ctx, m: scans},