fix(subsonic): albums, folders and search list only what the listener can play
getAlbum, getMusicDirectory and search2/3 ignored the listener's quarantine and listed missing files, which an app then failed to stream; song counts counted both. They now pass the listener and leave out missing files, as the mixes already did. Subsonic can't mark a song unplayable, so leaving it out is how the native apps' greyed-out row comes across. Song search filters in SQL (SearchPlayableTracks), so a library sync paging through search3 never gets a short page that reads as the end. Album song counts come from one query for the whole page (CountPlayableTracksByAlbums) instead of one per album. tracks.sql also drops CountTracksByArtist, which nothing called; see the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -213,16 +213,16 @@ func loadStarred(ctx context.Context, q *dbq.Queries, userID pgtype.UUID) ([]Son
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
counts, err := playableCounts(ctx, q, albumRows)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
for _, a := range albumRows {
|
||||
artist, err := q.GetArtistByID(ctx, a.ArtistID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
count, err := q.CountTracksByAlbum(ctx, a.ID)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
albums = append(albums, albumRef(a, artist.Name, int(count), 0))
|
||||
albums = append(albums, albumRef(a, artist.Name, counts[a.ID], 0))
|
||||
}
|
||||
|
||||
artistRows, err := q.ListLikedArtistRows(ctx, dbq.ListLikedArtistRowsParams{
|
||||
|
||||
Reference in New Issue
Block a user