+
{% include sidebar.html %}
-
-
📁 Projetos Disponíveis
-
-
-
-
-
-
-
-
-
-
-
+
+
📁 Projetos Disponíveis
+
+ Utilize os filtros laterais para refinar sua busca.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Desenhe o ritmo:
+
+ {% for i in (0..15) %}
+ {% assign mod = i | modulo: 4 %}
+ {% if i > 0 and mod == 0 %}
{% endif %}
+
+
+ {% endfor %}
+
+
Clique para ativar steps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% assign keys_list = "C,Cm,C#,C#m,Db,Dm,D,D#m,Eb,E,Em,F,Fm,F#,F#m,Gb,G,Gm,G#,Ab,A,Am,Bb,B,Bm" | split: "," %}
+ {% for key in keys_list %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+ {% assign filter_groups = "instruments|Instrumentos,plugins|Plugins,bassline|Bassline,automation|Automação,samples|Samples" | split: "," %}
+ {% for group in filter_groups %}
+ {% assign parts = group | split: "|" %}
+ {% assign cat_key = parts[0] %}
+ {% assign cat_label = parts[1] %}
+
+
+
+
+
+ {% assign current_list = "" %}
+ {% if cat_key == 'instruments' %}{% assign current_list = unique_instruments %}
+ {% elsif cat_key == 'plugins' %}{% assign current_list = unique_plugins %}
+ {% elsif cat_key == 'bassline' %}{% assign current_list = unique_bassline %}
+ {% elsif cat_key == 'automation' %}{% assign current_list = unique_automation %}
+ {% elsif cat_key == 'samples' %}{% assign current_list = unique_samples %}
+ {% endif %}
+
+ {% for item in current_list %}{% if item != "" %}
+
+ {% endif %}{% endfor %}
+
+
+
+ {% endfor %}
+
-
-
-
-
-
-
-
-
-
-
- Encontrados
- 0
- projetos.
-
-
-
-
-
Nenhum projeto encontrado.
-
+
+
+ Encontrados 0 projetos.
+
+
+
+ {% assign project_pages = site.pages | where_exp: "page", "page.path contains 'projetos/'" | sort: "title" %}
+ {% for page in project_pages %}
+ {% if page.url != '/projetos/' %}
+
+ {% assign raw_bpm = page.bpm | append: "" %}
+ {% if raw_bpm == "" or raw_bpm == "N/A" or raw_bpm == "nil" %}{% assign p_bpm = 0 %}{% else %}{% assign p_bpm = raw_bpm | plus: 0 %}{% endif %}
+
+ {% assign p_insts_array = "" | split: "," %}
+
+ {% assign project_patterns_flat = "" | split: "," %}
+ {% for track in page.tracks %}
+ {% if track.instruments %}{% for inst in track.instruments %}{% if inst.instrument_name %}{% assign p_insts_array = p_insts_array | push: inst.instrument_name %}{% endif %}
+ {% if inst.patterns %}
+ {% for pattern in inst.patterns %}
+ {% assign pattern_steps = pattern.steps %}
+ {% if pattern_steps and pattern_steps.size > 0 %}
+ {% assign chunk_string = "" %}
+ {% assign step_count = 0 %}
+ {% for step in pattern_steps %}
+ {% if step == true or step == 'true' or step == 1 %}{% assign chunk_string = chunk_string | append: '1' %}{% else %}{% assign chunk_string = chunk_string | append: '0' %}{% endif %}
+ {% assign step_count = step_count | plus: 1 %}
+ {% if step_count == 4 %}
+ {% unless project_patterns_flat contains chunk_string %}
+ {% assign project_patterns_flat = project_patterns_flat | push: chunk_string %}
+ {% endunless %}
+ {% assign chunk_string = "" %}
+ {% assign step_count = 0 %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
+ {% endif %}
+ {% endfor %}
+ {% elsif track.instrument_name %}{% assign p_insts_array = p_insts_array | push: track.instrument_name %}{% endif %}
+ {% endfor %}
+
+ {% assign p_patterns_str = project_patterns_flat | join: ',' %}
+ {% assign p_instruments_str = p_insts_array | uniq | join: ',' %}
+ {% assign p_plugins = page.tags.plugin | join: ',' %}
+ {% assign p_bassline = page.tags.bassline | join: ',' %}
+ {% assign p_automation = page.tags.automation | join: ',' %}
+ {% assign p_samples = page.tags.sample | join: ',' %}
+ {% assign p_name = page.title | default: page.name | downcase %}
+
+
+{% endif %}
+{% endfor %}
+
+
+
+
+
Nenhum projeto encontrado.
+
+
+
+{% include preview-modal.html %}
+
+ // Checkboxes Init
+ checkboxes.forEach(cb => cb.addEventListener('change', updateActiveSidebar));
+
+ // Inputs de Busca
+ searchInput.addEventListener('input', (e) => { searchText = e.target.value.toLowerCase().trim(); applyGlobalFilters(); });
+ clearInputBtn.addEventListener('click', () => { searchInput.value = ""; searchText = ""; applyGlobalFilters(); });
+
+ if(starFilterSelect) starFilterSelect.addEventListener('change', (e) => { currentMinStars = e.target.value; applyGlobalFilters(); });
+
+ if(sortSelect) sortSelect.addEventListener('change', (e) => {
+ const crit = e.target.value;
+ const cols = Array.from(projectsContainer.children);
+ cols.sort((a, b) => {
+ const getVal = (el, k) => parseFloat(el.getAttribute(k) || 0);
+ if(crit === 'stars_desc') return getVal(b, 'data-stars') - getVal(a, 'data-stars');
+ if(crit === 'stars_asc') return getVal(a, 'data-stars') - getVal(b, 'data-stars');
+ if(crit === 'bpm_desc') return getVal(b, 'data-bpm-real') - getVal(a, 'data-bpm-real');
+ if(crit === 'intensity_desc') return getVal(b, 'data-intensity') - getVal(a, 'data-intensity');
+ if(crit === 'intensity_asc') return getVal(a, 'data-intensity') - getVal(b, 'data-intensity');
+ return a.getAttribute('data-title').localeCompare(b.getAttribute('data-title'));
+ });
+ cols.forEach(c => projectsContainer.appendChild(c));
+ });
+
+ // Botões Limpar Grupo
+ clearGroupBtns.forEach(btn => {
+ btn.addEventListener('click', (e) => {
+ e.preventDefault(); e.stopPropagation();
+ const target = btn.dataset.target;
+ if(target === 'bpm') {
+ sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
+ } else if (target === 'pattern') {
+ searchSteps.forEach(s => s.classList.remove('is-active'));
+ updatePatternChunks();
+ applyGlobalFilters();
+ } else {
+ document.querySelectorAll(`.filter-checkbox[data-category="${target}"]`).forEach(cb => {
+ cb.checked = false;
+ if(cb.parentElement.classList.contains('tag')) cb.parentElement.classList.remove('is-checked');
+ });
+ updateActiveSidebar();
+ }
+ });
+ });
+
+ resetBtn.addEventListener('click', () => {
+ document.querySelectorAll('.filter-checkbox').forEach(cb => { cb.checked = false; cb.parentElement.classList.remove('is-checked'); });
+ searchInput.value = ""; searchText = "";
+ searchSteps.forEach(s => s.classList.remove('is-active'));
+ updatePatternChunks();
+ sliderMin.value = sliderMin.min; sliderMax.value = sliderMax.max; updateSlider();
+ starFilterSelect.value = 'all'; currentMinStars = 'all'; sortSelect.value = 'default';
+ updateActiveSidebar();
+ });
+
+
+ // --- 4. ENRIQUECIMENTO DOS CARDS COM JSON (FETCH) ---
+ const JSON_URL = '/mmpSearch/src_mmpSearch/saida_analises/db_final_completo.json';
+
+ fetch(JSON_URL)
+ .then(r => r.ok ? r.json() : [])
+ .then(data => {
+ enrichCards(data);
+ createGenreCheckboxes(data);
+
+ // Recalcula limites de BPM com base no JSON
+ const bpms = data.map(i => parseFloat(i.analise_tecnica?.bpm || 0)).filter(b => b > 0);
+ if(bpms.length > 0) {
+ const maxData = Math.ceil(Math.max(...bpms));
+ if(maxData > parseInt(sliderMax.max)) {
+ sliderMax.max = maxData;
+ inputMax.max = maxData;
+ sliderMin.max = maxData;
+ inputMin.max = maxData;
+ }
+ }
+ // Aplica filtros pela primeira vez APÓS carregar dados
+ applyGlobalFilters();
+ })
+ .catch(console.warn);
+
+ function normalizarChaveJS(str) {
+ if (!str) return "";
+ return str.toString().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]/g, "");
+ }
+
+ function renderizarDificuldade(num) {
+ const n = Math.round(num) || 1;
+ let label = "Básico", icon = "fa-leaf", color = "is-success";
+ if (n >= 4.5) { label = "Expert"; icon = "fa-fire"; color = "is-danger"; }
+ else if (n >= 3.5) { label = "Avançado"; icon = "fa-bolt"; color = "is-warning"; }
+ else if (n >= 2.5) { label = "Médio"; icon = "fa-layer-group"; color = "is-info"; }
+ return `
${label}`;
+ }
+
+ function enrichCards(data) {
+ const mapDados = {};
+ data.forEach(item => {
+ if(item.arquivo) mapDados[normalizarChaveJS(item.arquivo.replace('.ogg','').replace('.mp3',''))] = item;
+ if(item.dados_projeto?.titulo) mapDados[normalizarChaveJS(item.dados_projeto.titulo)] = item;
+ });
+
+ document.querySelectorAll('.project-item').forEach(item => {
+ const card = item.querySelector('.project-card');
+ const titleKey = normalizarChaveJS(item.getAttribute('data-title'));
+ const info = mapDados[titleKey];
+
+ let genero = "Unknown", subgeneros = [], estrelas = 0, intensidade = -100, bpm = 0, tomHtml = "", tomRaw = "all", subTagsHTML = "";
+
+ if (info) {
+ if (info.analise_ia) {
+ genero = info.analise_ia.genero_macro || "Unknown";
+ if (Array.isArray(info.analise_ia.nuvem_tags)) {
+ info.analise_ia.nuvem_tags.forEach(t => { if(t.tag) subgeneros.push(t.tag); });
+ info.analise_ia.nuvem_tags.slice(0, 2).forEach(t => {
+ subTagsHTML += `
#${t.tag}`;
+ });
+ }
+ }
+ if (info.analise_tecnica) {
+ intensidade = parseFloat(info.analise_tecnica.intensidade_db || -100);
+ bpm = parseFloat(info.analise_tecnica.bpm || 0);
+ estrelas = Math.round(info.analise_tecnica.complexidade?.estrelas || 0);
+ if (info.analise_tecnica.tom) {
+ const t = info.analise_tecnica.tom;
+ const e = info.analise_tecnica.escala === 'minor' ? 'm' : '';
+ tomRaw = t + e;
+ tomHtml = `
🎹 ${tomRaw}`;
+ }
+ }
+ }
+
+ item.setAttribute('data-genre', genero);
+ item.setAttribute('data-subgenres', subgeneros.join(',').toLowerCase());
+ item.setAttribute('data-stars', estrelas);
+ item.setAttribute('data-intensity', intensidade);
+ item.setAttribute('data-key', tomRaw);
+
+ if(bpm > 0) {
+ item.setAttribute('data-bpm-real', bpm);
+ if(item.getAttribute('data-bpm') == "0") item.setAttribute('data-bpm', Math.round(bpm));
+ }
+
+ const bpmContainer = card.querySelector('.bpm-container');
+ if(bpmContainer) {
+ let bpmDisplay = "";
+ if(bpm > 0) {
+ bpmDisplay = `
🎵 ${Math.round(bpm)} BPM`;
+ } else if (item.getAttribute('data-bpm') != "0") {
+ bpmDisplay = bpmContainer.innerHTML;
+ } else {
+ bpmDisplay = `
⚠️ BPM N/A`;
+ }
+
+ let newHtml = `
`;
+ newHtml += `
${renderizarDificuldade(estrelas)}
`;
+ newHtml += `
`;
+ if(genero !== "Unknown") {
+ let c = 'is-primary';
+ if(genero === 'Electronic') c = 'is-info';
+ if(genero === 'Hip Hop') c = 'is-warning';
+ if(genero === 'Rock') c = 'is-danger';
+ newHtml += `🤖 ${genero}`;
+ }
+ newHtml += tomHtml;
+ newHtml += `
`;
+ if(subTagsHTML) newHtml += `
${subTagsHTML}
`;
+ newHtml += `
`;
+
+ bpmContainer.innerHTML = bpmDisplay + newHtml;
+ }
+ });
+ }
+
+ function createGenreCheckboxes(data) {
+ const genres = new Set();
+ data.forEach(i => {
+ if(i.analise_ia?.genero_macro && i.analise_ia.genero_macro !== "Unknown") genres.add(i.analise_ia.genero_macro);
+ if(Array.isArray(i.analise_ia?.nuvem_tags)) i.analise_ia.nuvem_tags.forEach(t => genres.add(t.tag));
+ });
+
+ sidebarGenreContainer.innerHTML = "";
+ Array.from(genres).sort().forEach(g => {
+ const label = document.createElement('label');
+ label.className = "checkbox is-block mb-1 is-size-7";
+ label.innerHTML = `
${g}`;
+ sidebarGenreContainer.appendChild(label);
+ });
+
+ document.querySelectorAll('#sidebar-genres .filter-checkbox').forEach(cb => {
+ cb.addEventListener('change', updateActiveSidebar);
+ });
+ }
+
+ // Modal
+ const modal = document.getElementById('preview-modal');
+ const iframe = document.getElementById('preview-iframe');
+ const modalTitle = document.getElementById('modal-title');
+ const fullEditBtn = document.getElementById('full-edit-btn');
+ const closeButtons = document.querySelectorAll('.modal-background, .modal-card-head .delete, #close-modal-btn');
+ function openModal(url, title, btnText, btnLink) {
+ if(!modal) return; modalTitle.textContent = title; iframe.src = url; fullEditBtn.textContent = btnText; fullEditBtn.href = btnLink;
+ modal.classList.add('is-active'); document.documentElement.classList.add('is-clipped');
+ }
+ function closeModal() {
+ if(!modal) return; modal.classList.remove('is-active'); document.documentElement.classList.remove('is-clipped'); iframe.src = "";
+ }
+ document.querySelectorAll('.js-open-modal').forEach(btn => {
+ btn.addEventListener('click', (e) => { e.preventDefault(); openModal(btn.dataset.targetUrl, btn.dataset.modalTitle, btn.dataset.fullBtnText, btn.dataset.fullBtnLink); });
+ });
+ if(iframe) { iframe.addEventListener('load', () => { try {
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
+ const style = iframeDoc.createElement('style');
+ style.textContent = `.tabs, .navbar, .sidebar-wrapper, .main-header { display: none !important; } .publication { padding-top: 0 !important; } body { background-color: #fff !important; }`;
+ iframeDoc.head.appendChild(style); } catch(e){} });
+ }
+ closeButtons.forEach(el => el.addEventListener('click', closeModal));
+ document.addEventListener('keydown', (e) => { if (e.key === "Escape") closeModal(); });
+});
+
\ No newline at end of file