mirror of
https://github.com/kilyabin/psysonic.git
synced 2026-07-22 06:25:41 +00:00
4c70408bd6
* 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)
22 lines
834 B
TypeScript
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];
|
|
}
|