From 0874fd4f9f2cb5d337f1b08cc664f53fa0ccc945 Mon Sep 17 00:00:00 2001 From: Honey Date: Wed, 20 May 2026 23:06:17 +0200 Subject: [PATCH] feat: radio mode uses getSimilarSongs2 for artist/genre-aware playback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces getRandomSongs with getSimilarSongs2 seeded from the current track. Falls back to random if Navidrome returns nothing (no Last.fm config or unknown song). Deduplicates against songs already in the queue. Compatible with AudioMuse-AI plugin if added later — same endpoint, better results. Co-Authored-By: Claude Sonnet 4.6 --- src/player.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/player.js b/src/player.js index b8c5ec6..74f5e0d 100644 --- a/src/player.js +++ b/src/player.js @@ -618,8 +618,21 @@ export async function toggleRadioMode() { export async function fillRadioQueue() { if(!S.radioMode) return; try { - const r = await api('getRandomSongs', '&size=20'); - const newSongs = r.randomSongs?.song || []; + const seed = S.queue[S.qIdx]; + let newSongs = []; + if (seed?.id) { + const r = await api('getSimilarSongs2', `&id=${seed.id}&count=20`); + newSongs = r.similarSongs2?.song || []; + } + // Fall back to random if similar songs unavailable (no Last.fm config, unknown track, etc.) + if (!newSongs.length) { + const r = await api('getRandomSongs', '&size=20'); + newSongs = r.randomSongs?.song || []; + } + // Deduplicate against songs already queued + const existingIds = new Set(S.queue.map(s => s.id)); + newSongs = newSongs.filter(s => !existingIds.has(s.id)); + if (!newSongs.length) return; const prevLen = S.queue.length; S.queue.push(...newSongs); renderQueue();