Make the now-playing bar's title/artist clickable and add a cover art lightbox
The song title links to its album, the artist name links to the artist page, and clicking the cover art opens a larger version in a modal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014r98AtcBbevpscWLsfwVvv
This commit is contained in:
@@ -492,6 +492,21 @@ func ListSongArtistNames(db *sql.DB, songID string) ([]string, error) {
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
// PrimarySongArtistID returns the ID of a song's first-credited artist
|
||||
// (position 0), or "" if the song has no linked artist — used to link
|
||||
// the now-playing bar's artist name to that artist's page.
|
||||
func PrimarySongArtistID(db *sql.DB, songID string) (string, error) {
|
||||
var id string
|
||||
err := db.QueryRow(`SELECT a.id FROM song_artists sa JOIN artists a ON a.id = sa.artist_id WHERE sa.song_id = ? ORDER BY sa.position LIMIT 1`, songID).Scan(&id)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return "", nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func nullInt(n sql.NullInt64) any {
|
||||
if !n.Valid {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user