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:
@@ -59,7 +59,7 @@ func (q *Queries) AppendPlaylistTrack(ctx context.Context, arg AppendPlaylistTra
|
||||
const createPlaylist = `-- name: CreatePlaylist :one
|
||||
INSERT INTO playlists (user_id, name, description, is_public)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
RETURNING id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id
|
||||
RETURNING id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id, shelf_rank
|
||||
`
|
||||
|
||||
type CreatePlaylistParams struct {
|
||||
@@ -91,6 +91,7 @@ func (q *Queries) CreatePlaylist(ctx context.Context, arg CreatePlaylistParams)
|
||||
&i.Kind,
|
||||
&i.SystemVariant,
|
||||
&i.SeedArtistID,
|
||||
&i.ShelfRank,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@@ -132,7 +133,7 @@ func (q *Queries) DeletePlaylistTrack(ctx context.Context, arg DeletePlaylistTra
|
||||
}
|
||||
|
||||
const getPlaylist = `-- name: GetPlaylist :one
|
||||
SELECT p.id, p.user_id, p.name, p.description, p.is_public, p.cover_path, p.track_count, p.duration_sec, p.created_at, p.updated_at, p.kind, p.system_variant, p.seed_artist_id, u.username AS owner_username
|
||||
SELECT p.id, p.user_id, p.name, p.description, p.is_public, p.cover_path, p.track_count, p.duration_sec, p.created_at, p.updated_at, p.kind, p.system_variant, p.seed_artist_id, p.shelf_rank, u.username AS owner_username
|
||||
FROM playlists p
|
||||
JOIN users u ON u.id = p.user_id
|
||||
WHERE p.id = $1
|
||||
@@ -152,6 +153,7 @@ type GetPlaylistRow struct {
|
||||
Kind string
|
||||
SystemVariant *string
|
||||
SeedArtistID pgtype.UUID
|
||||
ShelfRank int32
|
||||
OwnerUsername string
|
||||
}
|
||||
|
||||
@@ -172,13 +174,14 @@ func (q *Queries) GetPlaylist(ctx context.Context, id pgtype.UUID) (GetPlaylistR
|
||||
&i.Kind,
|
||||
&i.SystemVariant,
|
||||
&i.SeedArtistID,
|
||||
&i.ShelfRank,
|
||||
&i.OwnerUsername,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getPlaylistsByIDs = `-- name: GetPlaylistsByIDs :many
|
||||
SELECT id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id FROM playlists WHERE id = ANY($1::uuid[])
|
||||
SELECT id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id, shelf_rank FROM playlists WHERE id = ANY($1::uuid[])
|
||||
`
|
||||
|
||||
// Batched lookup used by /api/library/sync to hydrate upsert payloads
|
||||
@@ -206,6 +209,7 @@ func (q *Queries) GetPlaylistsByIDs(ctx context.Context, dollar_1 []pgtype.UUID)
|
||||
&i.Kind,
|
||||
&i.SystemVariant,
|
||||
&i.SeedArtistID,
|
||||
&i.ShelfRank,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -380,7 +384,7 @@ func (q *Queries) ListPlaylistTracks(ctx context.Context, playlistID pgtype.UUID
|
||||
}
|
||||
|
||||
const listPlaylistsForUser = `-- name: ListPlaylistsForUser :many
|
||||
SELECT p.id, p.user_id, p.name, p.description, p.is_public, p.cover_path, p.track_count, p.duration_sec, p.created_at, p.updated_at, p.kind, p.system_variant, p.seed_artist_id, u.username AS owner_username
|
||||
SELECT p.id, p.user_id, p.name, p.description, p.is_public, p.cover_path, p.track_count, p.duration_sec, p.created_at, p.updated_at, p.kind, p.system_variant, p.seed_artist_id, p.shelf_rank, u.username AS owner_username
|
||||
FROM playlists p
|
||||
JOIN users u ON u.id = p.user_id
|
||||
WHERE p.user_id = $1 OR p.is_public = true
|
||||
@@ -401,6 +405,7 @@ type ListPlaylistsForUserRow struct {
|
||||
Kind string
|
||||
SystemVariant *string
|
||||
SeedArtistID pgtype.UUID
|
||||
ShelfRank int32
|
||||
OwnerUsername string
|
||||
}
|
||||
|
||||
@@ -429,6 +434,7 @@ func (q *Queries) ListPlaylistsForUser(ctx context.Context, userID pgtype.UUID)
|
||||
&i.Kind,
|
||||
&i.SystemVariant,
|
||||
&i.SeedArtistID,
|
||||
&i.ShelfRank,
|
||||
&i.OwnerUsername,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
@@ -480,7 +486,7 @@ SET
|
||||
is_public = CASE WHEN $5::boolean THEN $6::boolean ELSE is_public END,
|
||||
updated_at = now()
|
||||
WHERE id = $7
|
||||
RETURNING id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id
|
||||
RETURNING id, user_id, name, description, is_public, cover_path, track_count, duration_sec, created_at, updated_at, kind, system_variant, seed_artist_id, shelf_rank
|
||||
`
|
||||
|
||||
type UpdatePlaylistParams struct {
|
||||
@@ -521,6 +527,7 @@ func (q *Queries) UpdatePlaylist(ctx context.Context, arg UpdatePlaylistParams)
|
||||
&i.Kind,
|
||||
&i.SystemVariant,
|
||||
&i.SeedArtistID,
|
||||
&i.ShelfRank,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user