Files
mcma-webui/src/lib/radio.ts
T
Цвылев Александр Вадимович ac6b76bf98 feat(radio): wire radio + similarity into the queue (A11/B6, §6.5)
"Start radio" in the track menu seeds the queue from a track; RadioController
(headless, in AppShell) tops it up via /radio/next as it drains. QueuePanel's
radio scaffolding is now live: the exploration slider drives familiar<->new and
each entry shows its reason ("why this is playing"). Adds the radio endpoints
(start/next/similar), radio context + actions on the queue slice, and the pick->
entry mapper. Degrades to metadata picks while ML is offline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-29 02:40:13 +03:00

16 lines
501 B
TypeScript

import type { RadioPick } from '../api/types';
import type { QueueEntry } from '../store/slices/queue';
/** A radio/similar pick → a play-queue entry (carrying its reason code). */
export function pickToEntry(pick: RadioPick): QueueEntry {
return {
trackId: pick.track.id,
title: pick.track.title,
artistName: pick.track.artistName,
albumTitle: pick.track.albumTitle,
durationMs: pick.track.durationMs,
albumArtUrl: pick.track.albumArtUrl,
reason: pick.reason,
};
}