feat: radio mode uses getSimilarSongs2 for artist/genre-aware playback

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 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-20 23:06:17 +02:00
1 parent 2d0ee021e6
commit 0874fd4f9f
1 file changed
+14 -1
+14 -1
View File
@@ -618,8 +618,21 @@ export async function toggleRadioMode() {
export async function fillRadioQueue() {
if(!S.radioMode) return;
try {
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');
const newSongs = r.randomSongs?.song || [];
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();