feat: aprimorado o preview de falantes na tela Refinar para reprod
- aprimorado o preview de falantes na tela Refinar para reproduzir os trechos do vídeo - corrigida a leitura dos timestamps do preview de falantes usando os clipes do banco Resumo: - 5 arquivos alterados - 1 novos - 4 modificados - 0 removidos 4 files changed, 142 insertions(+), 3 deletions(-) Arquivos: - .jhonny/analises.db - code/cep-plugin/main.js - code/engine/persistencia/consultas.py - code/engine/testes/test_consultas_de_persistencia.py - code/engine/consultar_preview_de_falantes.py
This commit is contained in:
+33
-3
@@ -944,6 +944,7 @@ var RETAKES_ENGINE_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/co
|
||||
// (Python 3.14, com faster_whisper) garante que Scanner e Retakes carreguem bem.
|
||||
var SCANNER_PYTHON_BIN = "/Volumes/Merongo/SISTEMAS/venvs/whisperx-transcricao/bin/python";
|
||||
var ANALISE_STATUS_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/consultar_status_da_analise.py";
|
||||
var ANALISE_PREVIEW_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/consultar_preview_de_falantes.py";
|
||||
var retakesCasoAtual = null;
|
||||
var retakesGrupos = [];
|
||||
var retakesProcesso = null;
|
||||
@@ -2231,6 +2232,20 @@ function silenceConsultarStatusNoBanco(videoId) {
|
||||
} catch (_) { return null; }
|
||||
}
|
||||
|
||||
function silenceConsultarPreviewDeFalantes(videoId) {
|
||||
if (!videoId || !childProcess.spawnSync) return null;
|
||||
try {
|
||||
var resposta = childProcess.spawnSync(
|
||||
SCANNER_PYTHON_BIN,
|
||||
[ANALISE_PREVIEW_SCRIPT, videoId, "--banco", "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/.jhonny/analises.db"],
|
||||
{ cwd: "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code", encoding: "utf-8", maxBuffer: 4 * 1024 * 1024 }
|
||||
);
|
||||
if (resposta.status !== 0) return null;
|
||||
var dados = JSON.parse(String(resposta.stdout || "{}"));
|
||||
return Array.isArray(dados.intervalos) ? dados.intervalos : null;
|
||||
} catch (_) { return null; }
|
||||
}
|
||||
|
||||
function silenceLocalizarAudioParaFalantes(pasta) {
|
||||
var encontrados = [];
|
||||
function visitar(caminho) {
|
||||
@@ -2307,6 +2322,20 @@ function silenceLoadScannerAnalysis() {
|
||||
var turnos = transcricao.segments.filter(function (segmento) { return segmento.falante; }).map(function (segmento) {
|
||||
return { speaker: segmento.falante, start: segmento.start, end: segmento.end };
|
||||
});
|
||||
var intervalosDoBanco = silenceConsultarPreviewDeFalantes(silenceState.sequenceId);
|
||||
if (intervalosDoBanco && intervalosDoBanco.length) {
|
||||
turnos = intervalosDoBanco.map(function (intervalo) {
|
||||
return {
|
||||
speaker: intervalo.falante,
|
||||
start: intervalo.inicio,
|
||||
end: intervalo.fim,
|
||||
timelineStart: intervalo.inicio_na_timeline,
|
||||
timelineEnd: intervalo.fim_na_timeline,
|
||||
mediaPath: intervalo.arquivo,
|
||||
};
|
||||
});
|
||||
silenceState.mediaPath = intervalosDoBanco[0].arquivo || silenceState.mediaPath;
|
||||
}
|
||||
renderSpeakerConfiguration(falantes, turnos);
|
||||
atualizarTelaRefinar(falantes, audioDoBanco);
|
||||
status.textContent = "Carregada";
|
||||
@@ -3089,9 +3118,6 @@ function toggleSpeakerVideo(speakerId, button) {
|
||||
speakerVideoPlayer = video;
|
||||
preview.hidden = false;
|
||||
if (info) info.textContent = "Reproduzindo os trechos de " + speakerId + ".";
|
||||
video.src = speakerMediaFileUrl(silenceState.mediaPath);
|
||||
button.textContent = "■ vídeo";
|
||||
button.classList.add("is-playing");
|
||||
video.onloadedmetadata = playCurrentSpeakerVideoRange;
|
||||
video.ontimeupdate = advanceSpeakerVideoRange;
|
||||
video.onended = advanceSpeakerVideoRange;
|
||||
@@ -3099,6 +3125,10 @@ function toggleSpeakerVideo(speakerId, button) {
|
||||
stopSpeakerAudio();
|
||||
showToast("err", "Não foi possível reproduzir o vídeo deste falante.");
|
||||
};
|
||||
button.textContent = "■ vídeo";
|
||||
button.classList.add("is-playing");
|
||||
video.src = speakerMediaFileUrl(silenceState.mediaPath);
|
||||
video.load();
|
||||
}
|
||||
|
||||
function playCurrentSpeakerVideoRange() {
|
||||
|
||||
Reference in New Issue
Block a user