feat: Your genres leads with the genres you play most, not A to Z
release / web (push) Successful in 1m8s
release / go (push) Successful in 1m40s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 3m43s
release / android (push) Successful in 4m21s
release / Build signed APK (push) Successful in 4m55s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m8s
release / go (push) Successful in 1m40s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 3m43s
release / android (push) Successful in 4m21s
release / Build signed APK (push) Successful in 4m55s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped
The genre mix builder already ranks genres by how much you listen to them (taste profile, then plays and likes, then library size), but the rank was lost when the mixes were stored and both apps sorted the shelf by name. Each playlist now has a shelf_rank (migration 0107), which the genre builder fills 1..n in that listening order, even where it picked a narrower genre before a broader one. The list and detail endpoints carry it, and the web and Android Home sort the genre shelf by it, unranked playlists after by name. Android's playlist cache gains the column (Room v14). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -515,6 +515,9 @@ type builtPlaylist struct {
|
||||
Variant string
|
||||
SeedArtistID pgtype.UUID // zero value for non-seeded kinds
|
||||
Tracks []rankedCandidate
|
||||
// ShelfRank is the mix's place on its Home shelf, 1 first; 0 leaves
|
||||
// the order to the clients.
|
||||
ShelfRank int32
|
||||
}
|
||||
|
||||
// systemPlaylistProducer computes the playlists for one kind for a
|
||||
@@ -871,8 +874,7 @@ func BuildSystemPlaylists(ctx context.Context, pool *pgxpool.Pool, logger *slog.
|
||||
if len(bp.Tracks) == 0 {
|
||||
continue
|
||||
}
|
||||
id, err := insertSystemPlaylist(ctx, qtx, userID, bp.Name, bp.Variant,
|
||||
bp.SeedArtistID, bp.Tracks)
|
||||
id, err := insertSystemPlaylist(ctx, qtx, userID, bp)
|
||||
if err != nil {
|
||||
buildErr = fmt.Errorf("insert %s (%s): %w", bp.Variant, bp.Name, err)
|
||||
return buildErr
|
||||
@@ -1066,22 +1068,22 @@ func systemMixDescription(variant string) string {
|
||||
// in BuildSystemPlaylists overrides it with a 4-cell composite of the
|
||||
// contributing tracks' album art.
|
||||
func insertSystemPlaylist(ctx context.Context, qtx *dbq.Queries, userID pgtype.UUID,
|
||||
name, variant string, seedArtistID pgtype.UUID,
|
||||
tracks []rankedCandidate) (pgtype.UUID, error) {
|
||||
variantStr := variant
|
||||
bp builtPlaylist) (pgtype.UUID, error) {
|
||||
variantStr := bp.Variant
|
||||
p, err := qtx.CreateSystemPlaylist(ctx, dbq.CreateSystemPlaylistParams{
|
||||
UserID: userID,
|
||||
Name: name,
|
||||
Description: systemMixDescription(variant),
|
||||
Name: bp.Name,
|
||||
Description: systemMixDescription(bp.Variant),
|
||||
SystemVariant: &variantStr,
|
||||
SeedArtistID: seedArtistID,
|
||||
SeedArtistID: bp.SeedArtistID,
|
||||
CoverPath: nil,
|
||||
ShelfRank: bp.ShelfRank,
|
||||
})
|
||||
if err != nil {
|
||||
return pgtype.UUID{}, fmt.Errorf("insert playlist row: %w", err)
|
||||
}
|
||||
|
||||
tracks, err = oneCopyPerSong(ctx, qtx, tracks)
|
||||
tracks, err := oneCopyPerSong(ctx, qtx, bp.Tracks)
|
||||
if err != nil {
|
||||
return pgtype.UUID{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user