feat: corrigida a resolução da mídia real ao aplicar planos editor
- corrigida a resolução da mídia real ao aplicar planos editoriais salvos. - atualizada a guia Trilhas para recuperar e reaproveitar o catálogo salvo Resumo: - 5 arquivos alterados - 0 novos - 5 modificados - 0 removidos 5 files changed, 88 insertions(+), 9 deletions(-) Arquivos: - .jhonny/analises.db - code/cep-plugin/main.js - code/engine/analisar_trilhas.py - code/engine/persistencia/repositorio_de_trilhas.py - code/engine/testes/test_repositorio_de_trilhas.py
This commit is contained in:
+46
-3
@@ -2888,6 +2888,42 @@ function trilhasAoAbrir() {
|
||||
var pasta = document.getElementById("trilhasPasta");
|
||||
if (pasta && configuracao.pasta) pasta.value = configuracao.pasta;
|
||||
trilhasAtualizarEstado();
|
||||
if (pasta && pasta.value.trim() && fs.existsSync(pasta.value.trim())) trilhasAtualizarCatalogo(pasta.value.trim());
|
||||
}
|
||||
|
||||
function trilhasAtualizarCatalogo(pasta) {
|
||||
var argumentos = [TRILHAS_ENGINE_SCRIPT, pasta, "--banco", TRILHAS_BANCO_PATH, "--listar"];
|
||||
runStreamed(SCANNER_PYTHON_BIN, argumentos, function (linha) {
|
||||
if (linha.indexOf("@@PROGRESS ") !== 0) return;
|
||||
try { trilhasAtualizarEvento(JSON.parse(linha.slice(11))); } catch (_) {}
|
||||
}, function () {}, { cwd: "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code", stdio: ["ignore", "pipe", "pipe"] });
|
||||
}
|
||||
|
||||
function trilhasListarArquivos(pasta) {
|
||||
var extensoes = { ".wav": true, ".mp3": true, ".flac": true, ".m4a": true, ".aiff": true, ".ogg": true };
|
||||
var arquivos = [];
|
||||
function visitar(diretorio) {
|
||||
fs.readdirSync(diretorio).forEach(function (nome) {
|
||||
var caminho = path.join(diretorio, nome);
|
||||
var estatisticas = fs.statSync(caminho);
|
||||
if (estatisticas.isDirectory()) visitar(caminho);
|
||||
else if (estatisticas.isFile() && extensoes[path.extname(nome).toLowerCase()]) arquivos.push(caminho);
|
||||
});
|
||||
}
|
||||
visitar(pasta);
|
||||
return arquivos.sort();
|
||||
}
|
||||
|
||||
function trilhasPrepararLista(pasta) {
|
||||
try {
|
||||
var arquivos = trilhasListarArquivos(pasta);
|
||||
trilhasRenderizarLista(arquivos.map(function (arquivo) { return path.relative(pasta, arquivo) || path.basename(arquivo); }));
|
||||
document.getElementById("trilhasPastaStatus").textContent = arquivos.length
|
||||
? arquivos.length + " arquivo(s) de áudio encontrado(s). Pronto para análise."
|
||||
: "Nenhum arquivo de áudio compatível foi encontrado nesta pasta.";
|
||||
} catch (erro) {
|
||||
document.getElementById("trilhasPastaStatus").textContent = "Não foi possível ler a pasta selecionada.";
|
||||
}
|
||||
}
|
||||
|
||||
function trilhasSelecionarPasta() {
|
||||
@@ -2900,6 +2936,7 @@ function trilhasSelecionarPasta() {
|
||||
document.getElementById("trilhasPasta").value = escolhida;
|
||||
trilhasSalvarConfiguracao(escolhida);
|
||||
trilhasAtualizarEstado();
|
||||
trilhasPrepararLista(escolhida);
|
||||
} catch (erro) { showToast("err", erro.message); }
|
||||
}
|
||||
|
||||
@@ -2910,18 +2947,23 @@ function trilhasAtualizarEstado() {
|
||||
var valida = pasta.value.trim() && fs.existsSync(pasta.value.trim()) && fs.statSync(pasta.value.trim()).isDirectory();
|
||||
botao.disabled = !valida || taskState.active;
|
||||
document.getElementById("trilhasPastaStatus").textContent = valida ? "Pasta pronta para análise." : "Selecione uma pasta existente.";
|
||||
if (valida && !taskState.active && !document.querySelector(".trilha-item")) trilhasPrepararLista(pasta.value.trim());
|
||||
}
|
||||
|
||||
function trilhasRenderizarLista(nomes) {
|
||||
var lista = document.getElementById("trilhasLista");
|
||||
lista.innerHTML = "";
|
||||
(nomes || []).forEach(function (nome, indice) {
|
||||
(nomes || []).forEach(function (registro, indice) {
|
||||
var nome = typeof registro === "string" ? registro : registro.nome;
|
||||
var status = typeof registro === "string" ? "aguardando" : (registro.status || "aguardando");
|
||||
var item = document.createElement("div");
|
||||
item.className = "trilha-item";
|
||||
item.id = "trilha-item-" + indice;
|
||||
item.setAttribute("data-state", "aguardando");
|
||||
item.setAttribute("data-state", status === "concluida" ? "concluida" : status === "erro" ? "erro" : "aguardando");
|
||||
item.innerHTML = '<span class="trilha-check" aria-hidden="true"></span><div class="trilha-info"><strong></strong><span>Aguardando</span><div class="progress-track"><div class="progress-fill" style="width:0%"></div></div></div>';
|
||||
item.querySelector("strong").textContent = nome;
|
||||
item.querySelector(".trilha-info > span").textContent = status === "concluida" ? "Analisada" : status === "erro" ? "Erro na análise anterior" : "Aguardando análise";
|
||||
if (status === "concluida") item.querySelector(".progress-fill").style.width = "100%";
|
||||
lista.appendChild(item);
|
||||
});
|
||||
document.getElementById("trilhasContagem").textContent = (nomes || []).length + " trilha(s)";
|
||||
@@ -2929,7 +2971,8 @@ function trilhasRenderizarLista(nomes) {
|
||||
}
|
||||
|
||||
function trilhasAtualizarEvento(evento) {
|
||||
if (evento.evento === "lote_iniciado") { trilhasRenderizarLista(evento.nomes || []); return; }
|
||||
if (evento.evento === "catalogo_atualizado") { trilhasRenderizarLista(evento.trilhas || []); return; }
|
||||
if (evento.evento === "lote_iniciado") { trilhasRenderizarLista(evento.trilhas || evento.nomes || []); return; }
|
||||
if (!evento.nome) return;
|
||||
var itens = Array.prototype.slice.call(document.querySelectorAll(".trilha-item"));
|
||||
var item = itens.filter(function (elemento) { return elemento.querySelector("strong").textContent === evento.nome; })[0];
|
||||
|
||||
Reference in New Issue
Block a user