music box fixes

This commit is contained in:
Jakub Zych
2026-04-29 22:57:12 +02:00
parent a200fb8548
commit 579e4984c2
7 changed files with 36 additions and 25 deletions

View File

@@ -662,10 +662,10 @@ body {
}
function renderState(s) {
if (lastTrackIndex !== null && s.index !== lastTrackIndex && s.title) {
if (lastTrackFile !== null && s.file && s.file !== lastTrackFile && s.title) {
logBeforePins(`[audio] now: ${s.title}`);
}
lastTrackIndex = s.index;
if (s.file) lastTrackFile = s.file;
// Terminal pinned block
npTitle.textContent = s.title || '—';
@@ -829,7 +829,10 @@ body {
}
// ── State application ──
let lastTrackIndex = null;
// Dedupe by file URI, not s.index — MPD's status.song shifts mid-playback
// when the queue is reordered (consume mode, mpc shuffle, etc.), which
// would otherwise cause duplicate "now: …" lines for one playthrough.
let lastTrackFile = null;
function applyState(s) {
pendingState = s;
if (!bootStarted) {