feat: definido projeto com uma sequência e múltiplos arquivos de m
- definido projeto com uma sequência e múltiplos arquivos de mídia - criada persistência de projeto com uma sequência e seleções de faixas e clipes - criada guia Projeto para selecionar sequência, faixas e clipes do Premiere - adicionada gravação das seleções da guia Projeto no SQLite Resumo: - 10 arquivos alterados - 4 novos - 6 modificados - 0 removidos 6 files changed, 71 insertions(+), 2 deletions(-) Arquivos: - .jhonny/analises.db - CONTEXT.md - code/cep-plugin/index.html - code/cep-plugin/main.js - code/engine/persistencia/__init__.py - code/engine/persistencia/esquema.py - code/cep-plugin/abas/ - code/engine/persistencia/repositorio_de_projetos.py - code/engine/registrar_projeto_de_edicao.py - code/engine/testes/test_repositorio_de_projetos.py
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
// A guia Projeto mantém a seleção da sequência, faixas e clipes fora das
|
||||
// regras específicas de edição. O estado definitivo será persistido pelo
|
||||
// repositório SQLite na próxima etapa da integração.
|
||||
var projetoSequencias = [];
|
||||
var projetoAtual = null;
|
||||
|
||||
function projetoListarSequencias() {
|
||||
var botao = document.getElementById("btnProjetoCarregar");
|
||||
if (botao) botao.disabled = true;
|
||||
var select = document.getElementById("projetoSequenciaSelect");
|
||||
var info = document.getElementById("projetoInfo");
|
||||
info.textContent = "Lendo sequências, faixas e clipes do Premiere…";
|
||||
cs.evalScript(
|
||||
"(function(){try{" +
|
||||
"if(!app.project)return JSON.stringify({ok:false,error:'Nenhum projeto aberto.'});" +
|
||||
"var saida=[];" +
|
||||
"for(var i=0;i<app.project.sequences.numSequences;i++){" +
|
||||
"var s=app.project.sequences[i], faixas=[];" +
|
||||
"for(var v=0;v<s.videoTracks.numTracks;v++){var tv=s.videoTracks[v],cv=[];for(var j=0;j<tv.clips.numItems;j++){var x=tv.clips[j];cv.push({id:String(x.nodeId),nome:String(x.name||''),inicio:Number(x.start.seconds),fim:Number(x.end.seconds)});}faixas.push({id:'video_'+v,nome:'Vídeo '+(v+1),tipo:'video',indice:v,clipes:cv});}" +
|
||||
"for(var a=0;a<s.audioTracks.numTracks;a++){var ta=s.audioTracks[a],ca=[];for(var k=0;k<ta.clips.numItems;k++){var y=ta.clips[k];ca.push({id:String(y.nodeId),nome:String(y.name||''),inicio:Number(y.start.seconds),fim:Number(y.end.seconds)});}faixas.push({id:'audio_'+a,nome:'Áudio '+(a+1),tipo:'audio',indice:a,clipes:ca});}" +
|
||||
"saida.push({id:String(s.sequenceID),nome:String(s.name||''),duracao:Number(s.end.seconds||0),largura:Number(s.frameSizeHorizontal||0),altura:Number(s.frameSizeVertical||0),ativa:!!(app.project.activeSequence&&s.sequenceID===app.project.activeSequence.sequenceID),faixas:faixas});" +
|
||||
"}return JSON.stringify({ok:true,sequences:saida});}catch(e){return JSON.stringify({ok:false,error:String(e)});}}())",
|
||||
function (raw) {
|
||||
if (botao) botao.disabled = false;
|
||||
var resposta;
|
||||
try { resposta = JSON.parse(raw); } catch (erro) { resposta = {ok: false, error: "Resposta inválida do Premiere."}; }
|
||||
if (!resposta.ok) { info.textContent = resposta.error; return; }
|
||||
projetoSequencias = resposta.sequences || [];
|
||||
select.innerHTML = "";
|
||||
projetoSequencias.forEach(function (sequencia) {
|
||||
var opcao = document.createElement("option");
|
||||
opcao.value = sequencia.id;
|
||||
opcao.textContent = sequencia.nome + (sequencia.ativa ? " · ativa" : "");
|
||||
select.appendChild(opcao);
|
||||
});
|
||||
select.disabled = projetoSequencias.length === 0;
|
||||
if (projetoSequencias.length) {
|
||||
var ativa = projetoSequencias.findIndex(function (item) { return item.ativa; });
|
||||
select.selectedIndex = ativa >= 0 ? ativa : 0;
|
||||
projetoSelecionarSequencia();
|
||||
} else {
|
||||
info.textContent = "Nenhuma sequência encontrada no projeto do Premiere.";
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function projetoSelecionarSequencia() {
|
||||
var select = document.getElementById("projetoSequenciaSelect");
|
||||
projetoAtual = projetoSequencias.find(function (item) { return item.id === select.value; }) || null;
|
||||
if (!projetoAtual) return;
|
||||
document.getElementById("projetoTimelineCard").hidden = false;
|
||||
document.getElementById("projetoStatus").textContent = "Sequência selecionada";
|
||||
document.getElementById("projetoTimelineStatus").textContent = projetoAtual.nome;
|
||||
document.getElementById("projetoDuracao").textContent = formatSequenceDuration(projetoAtual.duracao);
|
||||
document.getElementById("projetoResolucao").textContent = projetoAtual.largura && projetoAtual.altura ? projetoAtual.largura + " × " + projetoAtual.altura : "Não informada";
|
||||
document.getElementById("projetoTotalFaixas").textContent = projetoAtual.faixas.length;
|
||||
document.getElementById("projetoTotalClipes").textContent = projetoAtual.faixas.reduce(function (total, faixa) { return total + faixa.clipes.length; }, 0);
|
||||
var container = document.getElementById("projetoFaixas");
|
||||
container.innerHTML = "";
|
||||
projetoAtual.faixas.forEach(function (faixa) {
|
||||
var bloco = document.createElement("div");
|
||||
bloco.className = "scanner-subsection";
|
||||
bloco.innerHTML = '<label class="checkbox-field"><input type="checkbox" checked data-projeto-faixa="' + faixa.id + '"><span>' + faixa.nome + " · " + faixa.clipes.length + " clipe(s)</span></label>";
|
||||
faixa.clipes.forEach(function (clipe) {
|
||||
bloco.innerHTML += '<label class="checkbox-field" style="padding-left:24px"><input type="checkbox" checked data-projeto-clipe="' + clipe.id + '"><span>' + clipe.nome + " · " + formatSequenceDuration(clipe.fim - clipe.inicio) + "</span></label>";
|
||||
});
|
||||
container.appendChild(bloco);
|
||||
});
|
||||
document.getElementById("btnProjetoContinuar").disabled = false;
|
||||
document.getElementById("btnProjetoSalvar").disabled = false;
|
||||
document.getElementById("projetoInfo").textContent = "A sequência foi carregada. Selecione as faixas e clipes que participarão do plano.";
|
||||
}
|
||||
|
||||
function projetoSalvar() {
|
||||
if (!projetoAtual) return;
|
||||
var faixas = Array.prototype.slice.call(document.querySelectorAll("[data-projeto-faixa]:checked")).map(function (item) { return item.getAttribute("data-projeto-faixa"); });
|
||||
var clipes = Array.prototype.slice.call(document.querySelectorAll("[data-projeto-clipe]:checked")).map(function (item) { return item.getAttribute("data-projeto-clipe"); });
|
||||
var pedido = path.join(os.tmpdir(), "pedido-projeto-edicao-" + Date.now() + ".json");
|
||||
fs.writeFileSync(pedido, JSON.stringify({
|
||||
nome: projetoAtual.nome, video_id: projetoAtual.id, faixas: faixas, clipes: clipes,
|
||||
}, null, 2), "utf-8");
|
||||
setBusy("btnProjetoSalvar", true);
|
||||
runStreamed(SCANNER_PYTHON_BIN, [REGISTRAR_PROJETO_SCRIPT, pedido, "--banco", ANALISES_DB_PATH],
|
||||
function (linha) { silenceLog(linha); },
|
||||
function (codigo, ultimoErro) {
|
||||
setBusy("btnProjetoSalvar", false);
|
||||
if (codigo !== 0) { showToast("err", ultimoErro || "Não foi possível salvar o projeto."); return; }
|
||||
document.getElementById("projetoStatus").textContent = "Projeto salvo no banco";
|
||||
showToast("ok", "Projeto salvo com " + faixas.length + " faixa(s) e " + clipes.length + " clipe(s).");
|
||||
});
|
||||
}
|
||||
|
||||
function projetoContinuarEdicao() {
|
||||
if (!projetoAtual) return;
|
||||
switchTab("silence");
|
||||
silenceListSequences();
|
||||
}
|
||||
@@ -28,7 +28,10 @@
|
||||
</header>
|
||||
|
||||
<nav class="tab-bar" role="tablist" aria-label="Painel">
|
||||
<button class="tab-button active" id="tabBtnScanner" role="tab" aria-selected="true" aria-controls="tabScanner" onclick="switchTab('scanner')" type="button">
|
||||
<button class="tab-button active" id="tabBtnProjeto" role="tab" aria-selected="true" aria-controls="tabProjeto" onclick="switchTab('projeto')" type="button">
|
||||
<span class="tab-icon" aria-hidden="true">▣</span>Projeto
|
||||
</button>
|
||||
<button class="tab-button" id="tabBtnScanner" role="tab" aria-selected="false" aria-controls="tabScanner" onclick="switchTab('scanner')" type="button">
|
||||
<span class="tab-icon" aria-hidden="true">◉</span>Scanner
|
||||
</button>
|
||||
<button class="tab-button" id="tabBtnRefinar" role="tab" aria-selected="false" aria-controls="tabRefinar" onclick="switchTab('refinar')" type="button">
|
||||
@@ -88,6 +91,35 @@
|
||||
<button type="button" class="toast-close" onclick="hideToast()" aria-label="Fechar aviso">✕</button>
|
||||
</div>
|
||||
|
||||
<!-- ================================ PROJETO ================================ -->
|
||||
<div class="tab-panel" id="tabProjeto" role="tabpanel" aria-labelledby="tabBtnProjeto">
|
||||
<p class="tab-intro">Um projeto contém uma única sequência e pode usar várias faixas, clipes e arquivos de mídia.</p>
|
||||
<section class="card">
|
||||
<div class="card-head"><h2>Sequência do projeto</h2><span class="card-kicker" id="projetoStatus">Aguardando seleção</span></div>
|
||||
<button class="button button-primary" id="btnProjetoCarregar" onclick="projetoListarSequencias()" type="button">Carregar sequências do Premiere</button>
|
||||
<label class="field-label" for="projetoSequenciaSelect">Sequência / timeline</label>
|
||||
<select id="projetoSequenciaSelect" class="select-field" onchange="projetoSelecionarSequencia()" disabled>
|
||||
<option value="">Nenhuma sequência carregada</option>
|
||||
</select>
|
||||
<p class="field-help" id="projetoInfo">Escolha a sequência que será a raiz deste projeto.</p>
|
||||
</section>
|
||||
<section class="card" id="projetoTimelineCard" hidden>
|
||||
<div class="card-head"><h2>Informações da timeline</h2><span class="card-kicker" id="projetoTimelineStatus">—</span></div>
|
||||
<dl class="kv">
|
||||
<div><dt>Duração</dt><dd id="projetoDuracao">—</dd></div>
|
||||
<div><dt>Resolução</dt><dd id="projetoResolucao">—</dd></div>
|
||||
<div><dt>Faixas</dt><dd id="projetoTotalFaixas">—</dd></div>
|
||||
<div><dt>Clipes</dt><dd id="projetoTotalClipes">—</dd></div>
|
||||
</dl>
|
||||
<h3>Faixas e clipes utilizados</h3>
|
||||
<div id="projetoFaixas" class="scanner-track-list"></div>
|
||||
<div class="button-row">
|
||||
<button class="button button-primary" id="btnProjetoSalvar" onclick="projetoSalvar()" type="button" disabled>Salvar projeto no banco</button>
|
||||
<button class="button button-primary" id="btnProjetoContinuar" onclick="projetoContinuarEdicao()" type="button" disabled>Continuar para editar vídeo</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- ============================= EDITAR VÍDEO ============================= -->
|
||||
<div class="tab-panel" id="tabSilence" role="tabpanel" aria-labelledby="tabBtnSilence" hidden>
|
||||
|
||||
@@ -675,6 +707,7 @@
|
||||
|
||||
<script charset="utf-8" src="CSInterface.js"></script>
|
||||
<script charset="utf-8" src="updater.cjs"></script>
|
||||
<script charset="utf-8" src="abas/projeto/projeto.js"></script>
|
||||
<script charset="utf-8" src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -243,6 +243,7 @@ function stepState(n) {
|
||||
// ---- Tabs ----
|
||||
function switchTab(name) {
|
||||
var tabs = [
|
||||
{ key: "projeto", panel: "tabProjeto", btn: "tabBtnProjeto" },
|
||||
{ key: "scanner", panel: "tabScanner", btn: "tabBtnScanner" },
|
||||
{ key: "refinar", panel: "tabRefinar", btn: "tabBtnRefinar" },
|
||||
{ key: "silence", panel: "tabSilence", btn: "tabBtnSilence" },
|
||||
@@ -265,6 +266,7 @@ function switchTab(name) {
|
||||
btn.setAttribute("aria-selected", String(active));
|
||||
});
|
||||
if (name === "models") renderModelList();
|
||||
if (name === "projeto") projetoListarSequencias();
|
||||
if (name === "silence") { syncTranscribeModelSelect(); syncLanguageInfo(); renderizarTiposDeVideoParaEdicao(); }
|
||||
if (name === "settings") renderEditorPersonalities();
|
||||
if (name === "scanner") { renderScannerTranscriptionOptions(); loadScannerProfile(); renderScannerHuggingFaceStatus(); scannerListarAnalisesExistentes(); }
|
||||
@@ -947,6 +949,7 @@ var ANALISE_STATUS_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/co
|
||||
var ANALISE_PREVIEW_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/consultar_preview_de_falantes.py";
|
||||
var REGISTRAR_EDICAO_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/registrar_edicao.py";
|
||||
var CARREGAR_PLANO_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/carregar_plano_de_edicao.py";
|
||||
var REGISTRAR_PROJETO_SCRIPT = "/Volumes/Merongo/SISTEMAS/GENIAL SISTEMAS/Jhonny/code/engine/registrar_projeto_de_edicao.py";
|
||||
var planoEditorialIdCarregado = null;
|
||||
var retakesCasoAtual = null;
|
||||
var retakesGrupos = [];
|
||||
@@ -4129,7 +4132,7 @@ function downloadModel(model, btn, approxMB) {
|
||||
(function init() {
|
||||
// A identificação de locutores pertence ao Scanner; abrir nele evita que o
|
||||
// painel pareça travado na etapa antiga de edição de vídeo.
|
||||
switchTab("scanner");
|
||||
switchTab("projeto");
|
||||
|
||||
// Set the default temp dir in the input field
|
||||
document.getElementById("tempDir").value = tempDir;
|
||||
|
||||
Reference in New Issue
Block a user