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

@@ -92,8 +92,8 @@ body {
.terminal {
width: 60vw;
max-width: 1380px;
height: 58vh;
max-height: 740px;
height: 62vh;
max-height: 820px;
min-height: 400px;
position: relative;
overflow: hidden;
@@ -514,10 +514,10 @@ body {
function renderMusicState(s) {
if (!npLine) ensureNowPlayingLine();
if (lastTrackIndex !== null && s.index !== lastTrackIndex) {
if (lastTrackFile !== null && s.file && s.file !== lastTrackFile) {
logBeforeNp(`[audio] next: ${s.title || '?'}`);
}
lastTrackIndex = s.index;
if (s.file) lastTrackFile = s.file;
npLine.querySelector('.np-title').textContent = s.title || '—';
npLine.querySelector('.np-time').textContent =
`[${fmtClock(s.currentTime)} / ${fmtClock(s.duration)}]`;
@@ -537,9 +537,9 @@ body {
append('> ', `[audio] indexed ${allTracks.length} tracks`, 'term-out');
await sleep(180);
append('> ', '[audio] connecting to daemon on ws://localhost:4455', 'term-out');
append('> ', `[audio] uplink to daemon @ ophi-118://${rigName.toLowerCase()}.audio.bus`, 'term-out');
await sleep(180);
append('> ', '[audio] subscribing to mpd:state events', 'term-out');
append('> ', '[audio] chat ops armed :: !skip · !queue · !info', 'term-out');
await sleep(180);
append('> ', '[audio] standby for transmission ✓', 'term-out');
bootFinished = true;
@@ -547,7 +547,8 @@ body {
}
// Connect to OBS WebSocket and listen for daemon broadcasts.
let lastTrackIndex = null;
// Dedupe by file URI — see music-box/index.html for the rationale.
let lastTrackFile = null;
async function connectMusic() {
if (!window.__OBSWS) {
logBeforeNp('[audio] vendor/obs-config.js missing — run scripts/setup.sh', 'term-dim');