testando pós scripts

This commit is contained in:
JotaChina committed 2026-02-19 09:42:44 -03:00
1 parent 0a2815a731
commit f7ff164eb9
284 files changed
+6500484 -656933

No files matched your search

Binary file not shown.
Binary file not shown.
+9 -4
View File
@@ -3,11 +3,12 @@
import os
import json
import logging
import yaml # <--- Requer: pip install pyyaml
import yaml
# Caminhos relativos baseados na raiz do projeto passada como argumento
from utils import CONFIGS, scan_directory_list, scan_directory_tree
def generate_manifests(project_root_path):
"""
Gera os manifestos e retorna um dicionário com estatísticas.
@@ -41,9 +42,13 @@ def generate_manifests(project_root_path):
# DECISÃO: Salvar como YAML ou JSON baseado na extensão
with open(output_file_abs, "w", encoding="utf-8") as f:
if output_file_abs.endswith(".yml") or output_file_abs.endswith(".yaml"):
if output_file_abs.endswith(".yml") or output_file_abs.endswith(
".yaml"
):
# allow_unicode=True é CRUCIAL para acentos funcionarem
yaml.dump(result_data, f, allow_unicode=True, default_flow_style=False)
yaml.dump(
result_data, f, allow_unicode=True, default_flow_style=False
)
else:
json.dump(result_data, f, indent=2, ensure_ascii=False)
@@ -54,4 +59,4 @@ def generate_manifests(project_root_path):
logging.error(f"Erro ao gerar {config['output_file']}: {e}")
report["failed"].append(f"{config['output_file']} (Erro: {str(e)})")
return report
return report
+10 -1
View File
@@ -16,6 +16,8 @@ from datetime import datetime, timedelta
# Importando seus módulos locais
from generate_manifest import generate_manifests
# from src_instruments import find_audio_files
from file_parser import parse_mmp_file
from file_saver import save_to_json, save_to_yaml
from dependency_checker import check_dependencies
@@ -450,10 +452,15 @@ def main_parallel():
logging.info(f"Total processado com sucesso: {len(successful_data)}")
logging.info(f"Iniciando gravação em lotes (Batch Size: {BATCH_SIZE})...")
# 1. Salvar JSON Completo (Geralmente seguro)
# 1. Salvar JSON Completo
logging.info("Salvando all.json completo...")
save_to_json(successful_data, os.path.join(METADATA_FOLDER, "all.json"))
# --- ADIÇÃO: Salvar YAML Completo (all.yml) ---
logging.info("Salvando all.yml completo...")
save_to_yaml(successful_data, os.path.join(DATA_FOLDER, "all.yml"))
# ----------------------------------------------
# 2. Salvar YAML em Fatias (Para evitar memory overflow)
total_items = len(successful_data)
for i in range(0, total_items, BATCH_SIZE):
@@ -473,6 +480,8 @@ def main_parallel():
# Geração dos manifestos
try:
manifest_report = generate_manifests(SRC_MMPSEARCH)
# base_dir_instruments = "/nethome/jotachina/projetos/mmpSearch/mmp/instruments"
# manifest_instruments = find_audio_files(base_dir_instruments)
except Exception as e:
manifest_report = {"generated": [], "failed": [str(e)]}
+9 -3
View File
@@ -5,19 +5,25 @@ import json
base_dir = "/nethome/jotachina/projetos/mmpSearch/mmp/instruments"
# Caminho para salvar o arquivo JSON na pasta metadata (na raiz do seu site)
output_file = "metadata/src_audio_files.json" # Substitua com o caminho correto
output_file = "/var/www/html/trens/src_mmpSearch/metadata/src_audio_files.json" # Substitua com o caminho correto
# Função para percorrer o diretório e suas subpastas
def find_audio_files(base_dir):
audio_files = []
for root, dirs, files in os.walk(base_dir):
for file in files:
if (file.endswith(".wav") or file.endswith(".ogg") or
file.endswith(".flac") or file.endswith(".mp3")):
if (
file.endswith(".wav")
or file.endswith(".ogg")
or file.endswith(".flac")
or file.endswith(".mp3")
):
# Adiciona o caminho completo do arquivo
audio_files.append(os.path.join(root, file))
return audio_files
# Chama a função para encontrar os arquivos
audio_files = find_audio_files(base_dir)