fix issue with tracking auto sync playlist node

This commit is contained in:
Broque Thomas 2026-03-06 08:01:17 -08:00
parent 69d16ec402
commit 7485ba8aa2
2 changed files with 24 additions and 2 deletions

View file

@ -462,10 +462,12 @@ def _register_automation_handlers():
if extra.get('discovered') and extra.get('matched_data'):
# Use official discovered metadata
md = extra['matched_data']
album_raw = md.get('album', '')
album_obj = album_raw if isinstance(album_raw, dict) else {'name': album_raw or ''}
tracks_json.append({
'name': md.get('name', ''),
'artists': md.get('artists', [{'name': t.get('artist_name', '')}]),
'album': md.get('album', ''),
'album': album_obj,
'duration_ms': md.get('duration_ms', 0),
'id': md.get('id', ''),
})

View file

@ -42385,11 +42385,12 @@ function updateAutomationProgressFromData(data) {
}
}
// Diff-append log lines
// Update log lines
const logEl = panel.querySelector('.auto-progress-log');
const rendered = _autoProgressLogCounts[aid] || 0;
const logLines = state.log || [];
if (logLines.length > rendered) {
// Normal append — log is still growing
for (let i = rendered; i < logLines.length; i++) {
const line = logLines[i];
const div = document.createElement('div');
@ -42399,6 +42400,25 @@ function updateAutomationProgressFromData(data) {
}
_autoProgressLogCounts[aid] = logLines.length;
logEl.scrollTop = logEl.scrollHeight;
} else if (logLines.length === rendered && logLines.length >= 50) {
// Log buffer is full and rotating — replace last few lines
const children = logEl.children;
if (children.length > 0) {
const lastServerLine = logLines[logLines.length - 1];
const lastDomLine = children[children.length - 1];
if (lastServerLine && lastDomLine.textContent !== lastServerLine.text) {
// Content changed — full re-render
logEl.innerHTML = '';
for (const line of logLines) {
const div = document.createElement('div');
div.className = 'auto-log-line ' + (line.type || 'info');
div.textContent = line.text;
logEl.appendChild(div);
}
_autoProgressLogCounts[aid] = logLines.length;
logEl.scrollTop = logEl.scrollHeight;
}
}
}
}
}