feat(subsonic): scan status, artist and album info, lyrics, ratings and users
release / go (push) Failing after 1m15s
release / web (push) Successful in 1m18s
release / govulncheck (push) Successful in 21s
release / integration (push) Successful in 3m57s
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 / android (push) Canceled after 4m33s
release / Build signed APK (push) Canceled after 4m9s

The last Subsonic methods apps call that Minstrel didn't answer:

- getScanStatus counts the songs whose files are present and says
  whether a scan is running; startScan, for an admin, starts the scan the
  web app's Rescan starts, and answers "scanning" straight away since the
  scan records itself a moment later.
- getArtistInfo and getArtistInfo2 give the artist's MusicBrainz id and the
  artists in this library that sound like them, from an artist, album or
  song id; getAlbumInfo and getAlbumInfo2 give the album's MusicBrainz id.
  Minstrel fetches no biographies or outside images, so none are sent.
- getLyrics (by artist and title) and getLyricsBySongId (OpenSubsonic
  songLyrics, now declared) read lyrics when asked: a .lrc file beside the
  song gives timed lyrics, otherwise the song's own lyrics tag.
- setRating accepts a rating and keeps none: a like is Minstrel's only
  rating, and a low rating is never read as a dislike.
- getUsers lists every user, for an admin only.

ArtistRef no longer fixes its XML element name, so it can appear as
similarArtist; every field holding it names the element.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 17:43:13 -05:00
co-authored by Claude Opus 5.5
parent b801f81058
commit f87aba5b86
14 changed files with 1022 additions and 18 deletions
+21
View File
@@ -5,6 +5,7 @@ import (
"errors"
"net/http"
"slices"
"strconv"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
@@ -240,3 +241,23 @@ func loadStarred(ctx context.Context, q *dbq.Queries, userID pgtype.UUID) ([]Son
return songs, albums, artists, nil
}
// handleSetRating accepts a rating and keeps none. Minstrel's only rating is
// a like, which apps set with star. A rating is not turned into a like,
// because a rating is not a yes or no; and a low rating is never read as a
// dislike, because what a listener doesn't want is learned from skips. The
// call answers ok so an app's rating control does not show an error.
// rating must still be 0 to 5, as the spec has it.
func (m *mediaHandlers) handleSetRating(w http.ResponseWriter, r *http.Request) {
params := r.URL.Query()
if params.Get("id") == "" || params.Get("rating") == "" {
WriteFail(w, r, ErrMissingParameter, "Missing required parameter: id and rating")
return
}
rating, err := strconv.Atoi(params.Get("rating"))
if err != nil || rating < 0 || rating > 5 {
WriteFail(w, r, ErrGeneric, "rating must be 0 to 5")
return
}
Write(w, r, NewEnvelope("ok"))
}