Files
ableton-mcp-ai/AbletonMCP_AI/rebuild_index.py
renato97 f5be1309d2 Migración completa a librería Reggaeton
Cambios realizados:
- server.py: actualiza PROJECT_SAMPLES_DIR a reggaeton
- sample_manager.py: cambia base_dir a reggaeton + agrega género reggaeton
- health_check.py: actualiza paths a reggaeton
- scan_audio.py: actualiza path a reggaeton
- segment_rag_builder.py: actualiza default library a reggaeton
- reference_stem_builder.py: actualiza PROJECT_SAMPLES_DIR a reggaeton
- song_generator.py: agrega GENRE_CONFIG y SECTION_BLUEPRINT para reggaeton
- rebuild_index.py: actualiza para apuntar a reggaeton

Nueva estructura soportada:
- 1. MIDI CHORDS / 2. MIDI ARP (MIDI files)
- 3. ONE SHOTS / 4. DRUM LOOPS
- 5. FX / 6. IMPACT INTRO / 7. FILL
- 8. KICKS / 9. SNARE / 10. PERCS
- 11. VOCALS
- reggaeton 2/ (bass, drumloops, fx, kick, oneshots, perc, snare)
- SentimientoLatino2025/ (drums, vocals, loops, one shots)

Index rebuilt: 508 samples
2026-03-29 16:41:20 -03:00

54 lines
1.8 KiB
Python

"""
rebuild_index.py - Reconstruir índice de embeddings para reggaeton
"""
import sys
import logging
from pathlib import Path
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
logger = logging.getLogger(__name__)
# Add MCP_Server to path
sys.path.insert(0, str(Path(__file__).parent / "MCP_Server"))
from vector_manager import VectorManager
def rebuild_index():
# Ruta correcta - reggaeton está en el root de MIDI Remote Scripts
library_path = Path("C:/ProgramData/Ableton/Live 12 Suite/Resources/MIDI Remote Scripts/librerias/reggaeton")
logger.info(f"Reconstruyendo indice para: {library_path}")
logger.info(f"La ruta existe: {library_path.exists()}")
if library_path.exists():
# Listar subcarpetas con archivos
total_wav = 0
for subdir in library_path.rglob("*"):
if subdir.is_dir():
wav_files = list(subdir.glob("*.wav"))
if wav_files:
logger.info(f" {subdir.relative_to(library_path)}: {len(wav_files)} archivos .wav")
total_wav += len(wav_files)
logger.info(f"Total: {total_wav} archivos .wav")
logger.info("=" * 60)
# Eliminar índice existente si hay
index_file = library_path / ".sample_embeddings.json"
if index_file.exists():
logger.info(f"Eliminando indice antiguo: {index_file}")
index_file.unlink()
# Crear nuevo VectorManager (auto-rebuild)
vm = VectorManager(str(library_path), skip_audio_analysis=False)
logger.info("=" * 60)
logger.info(f"Indice reconstruido con {len(vm.metadata)} samples")
logger.info(f"Archivo: {index_file}")
return len(vm.metadata)
if __name__ == "__main__":
count = rebuild_index()
print(f"\nIndice listo: {count} samples")