feat(subsonic): apps can make, change and delete playlists (#8021)
release / web (push) Successful in 1m43s
release / go (push) Successful in 2m21s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 4m31s
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 2m44s
release / android (push) Canceled after 3m43s

createPlaylist makes a playlist, or with playlistId replaces its songs;
updatePlaylist renames it, sets its comment and visibility, removes songs
by the index the app was shown and adds songs; deletePlaylist deletes it.
A song index counts only the entries getPlaylist lists, so a hidden
entry ahead of it doesn't shift which song goes.

The playlist service gains ReplaceTracks and RemovePositions; the owner
and system-mix checks that each change repeated are one function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 10:17:15 -05:00
co-authored by Claude Opus 5.5
parent 3491cf4c58
commit df2095baae
7 changed files with 614 additions and 180 deletions
+2 -17
View File
@@ -303,24 +303,9 @@ func TestGetSimilarSongs_IsRadioFromASongAlbumOrArtist(t *testing.T) {
// playlist is neither listed nor readable.
func TestGetPlaylists_MixesFirstAndOnlyWhatTheListenerMaySee(t *testing.T) {
f := seedPicks(t)
ctx := context.Background()
svc := playlists.NewService(f.pool, nil, "")
svc := playlists.NewService(f.pool, nil, t.TempDir())
newPlaylist := func(owner dbq.User, name string, public bool, songs ...string) pgtype.UUID {
t.Helper()
p, err := svc.Create(ctx, owner.ID, name, "", public)
if err != nil {
t.Fatalf("create %s: %v", name, err)
}
ids := make([]pgtype.UUID, 0, len(songs))
for _, s := range songs {
ids = append(ids, f.tracks[s].ID)
}
if len(ids) > 0 {
if err := svc.AppendTracks(ctx, owner.ID, p.ID, ids); err != nil {
t.Fatalf("append %s: %v", name, err)
}
}
return p.ID
return f.newList(t, svc, owner, name, public, songs...)
}
mine := newPlaylist(f.user, "Road Songs", false, "Inlet", "Jetty", "Dusk")
mix := newPlaylist(f.user, "For you", false, "Gale", "Harbour")