Registra: messaggi di errore azionabili + log tecnici espandibili
Sul sistema dell'utente il comando ffmpeg che usa l'app funziona correttamente (testato come subprocess identico), ma il vecchio reporting era confuso quando l'errore era transitorio (BlackHole non pronto, clock drift, ecc.) o quando la parola 'abort' non compariva nello stderr. Cambiamenti: core/recorder.py: - _extract_friendly_error riconosce ora piu casi: input/output error (BlackHole non pronto -> suggerisce 'sudo killall coreaudiod'), device not configured, permission denied, no such device - rc=-6 su macOS ritorna SEMPRE il messaggio sul permesso Microfono (prima richiedeva 'abort' nello stderr, non sempre presente) - Fallback finale mostra anche le ultime 3 righe di stderr - Nuova funzione get_last_stderr() per debugging api/bridge.py: - Nuovo metodo get_recorder_log() che ritorna stderr per la UI webui: - Nuova card di errore persistente con bottoni 'Mostra log tecnici' / 'Copia log' - Si resetta automaticamente all'avvio di una nuova registrazione Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d8290579b
commit
f339197861
5 files changed
+140
-16
No files matched your search
+35
-1
@@ -222,6 +222,7 @@ const bridgeHandlers = {
|
||||
$("#recRefreshBtn").disabled = true;
|
||||
$("#recTimer").textContent = "00:00:00";
|
||||
$("#recStatus").textContent = "● Registrazione in corso…";
|
||||
$("#recErrorCard").hidden = true; // pulisci eventuale errore precedente
|
||||
} else if (status === "tick") {
|
||||
state.rec.seconds = p.seconds || 0;
|
||||
$("#recTimer").textContent = formatHms(state.rec.seconds);
|
||||
@@ -247,7 +248,14 @@ const bridgeHandlers = {
|
||||
$("#recDevice").disabled = false;
|
||||
$("#recRefreshBtn").disabled = false;
|
||||
$("#recStatus").textContent = "";
|
||||
toast("Errore registrazione: " + (p.error || ""), "error");
|
||||
const msg = p.error || "Errore sconosciuto";
|
||||
$("#recErrorMsg").textContent = msg;
|
||||
$("#recErrorCard").hidden = false;
|
||||
$("#recErrorLog").hidden = true;
|
||||
$("#recErrorLog").textContent = "";
|
||||
$("#recCopyLogBtn").hidden = true;
|
||||
$("#recShowLogBtn").textContent = "Mostra log tecnici";
|
||||
toast("Errore registrazione", "error");
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -695,6 +703,32 @@ $("#recStopBtn").addEventListener("click", async () => {
|
||||
await window.pywebview.api.stop_audio_recording();
|
||||
});
|
||||
|
||||
$("#recShowLogBtn")?.addEventListener("click", async () => {
|
||||
const pre = $("#recErrorLog");
|
||||
if (!pre.hidden) {
|
||||
pre.hidden = true;
|
||||
$("#recShowLogBtn").textContent = "Mostra log tecnici";
|
||||
$("#recCopyLogBtn").hidden = true;
|
||||
return;
|
||||
}
|
||||
const res = await window.pywebview.api.get_recorder_log();
|
||||
const lines = (res && res.lines) || [];
|
||||
pre.textContent = lines.length ? lines.join("\n") : "(log vuoto)";
|
||||
pre.hidden = false;
|
||||
$("#recShowLogBtn").textContent = "Nascondi log tecnici";
|
||||
$("#recCopyLogBtn").hidden = false;
|
||||
});
|
||||
|
||||
$("#recCopyLogBtn")?.addEventListener("click", async () => {
|
||||
const text = $("#recErrorLog").textContent || "";
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
toast("Log copiato negli appunti", "success");
|
||||
} catch {
|
||||
toast("Impossibile copiare", "error");
|
||||
}
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// METADATA editor
|
||||
// ============================================================
|
||||
|
||||
Reference in new issue
Block a user