Files
psysonic/src/utils/playback/trackArtistRefs.ts
T
cucadmuh 4c70408bd6 fix(now-playing): split artist links and About the Artist tabs (#960)
* fix(now-playing): split artist links and About the Artist tabs

OpenSubsonic artists[] now drives per-artist navigation on Now Playing
hero and the queue current-track row (matching player bar). About the
Artist loads bio for each performer via tabs when a track has multiple
artist ids; queue Info uses the primary ref for bio/tour fetch.

Reported by zunoz on the Psysonic Discord (v1.47.0-rc.3).

* docs: note Now Playing multi-artist fix in CHANGELOG (PR #960)
2026-06-03 22:16:06 +03:00

22 lines
834 B
TypeScript

import type { SubsonicOpenArtistRef } from '../../api/subsonicTypes';
import type { Track } from '../../store/playerStoreTypes';
type TrackArtistFields = Pick<Track, 'artist' | 'artistId' | 'artists'>;
/** OpenSubsonic `artists` when present; else legacy `artistId` + `artist` (album track rows). */
export function resolveTrackArtistRefs(track: TrackArtistFields): SubsonicOpenArtistRef[] {
if (track.artists && track.artists.length > 0) {
return track.artists;
}
const id = track.artistId?.trim();
if (id) {
return [{ id, name: track.artist }];
}
return [{ name: track.artist }];
}
/** First performer ref — used for artist bio / discography / top songs on Now Playing. */
export function primaryTrackArtistRef(track: TrackArtistFields): SubsonicOpenArtistRef {
return resolveTrackArtistRefs(track)[0];
}