import warnings; warnings.filterwarnings("ignore")
import sys, os
sys.path.insert(0, r"C:\Users\Administrator\Documents\fl_control")
from src.analyzer import analyze_file

# Use REAL paths from the library
base = r"C:\Users\Administrator\Documents\fl_control"
spack = r"libreria\reggaeton\SentimientoLatino2025\01\LATINOS  -  SAMPLE PACK"

tests = [
    ("ML Lead",    os.path.join(base, spack, r"Midilatino_El_Despegue_F#_Min_92BPM\Midilatino_El_Despegue_F#_Min_92BPM_Lead.wav")),
    ("ML Bass",    os.path.join(base, spack, r"Midilatino_Cookie_E_Min_89BPM\Midilatino_Cookie_E_Min_89BPM_Bass.wav")),
    ("ML Pad",     os.path.join(base, spack, r"Midilatino_Cielo_F_Min_90BPM\Midilatino_Cielo_F_Min_90BPM_Pad.wav")),
    ("ML Pluck",   os.path.join(base, spack, r"Midilatino_Get Me_E_Min_104BPM\Midilatino_Get Me_E_Min_104BPM_Pluck.wav")),
    ("ML Drums",   os.path.join(base, spack, r"Midilatino_Anonaki_D#_Min_103BPM @PromoViDo vip Telegram\Midilatino_Anonaki_D#_Min_103BPM_Drums.wav")),
    ("ML FullMix", os.path.join(base, spack, r"Midilatino_Anonaki_D#_Min_103BPM @PromoViDo vip Telegram\Midilatino_Anonaki_D#_Min_103BPM.wav")),
    ("ML Arp",     os.path.join(base, spack, r"Midilatino_Classic_G#_Min_105BPM\Midilatino_Classic_G#_Min_105BPM_Arp.wav")),
    ("ML Vocal",   os.path.join(base, spack, r"Midilatino_Cookie_E_Min_89BPM\Midilatino_Cookie_E_Min_89BPM_Vocal.wav")),
    ("ML Guitar",  os.path.join(base, spack, r"Midilatino_Get Me_E_Min_104BPM\Midilatino_Get Me_E_Min_104BPM_Guitar.wav")),
    ("ML Reese",   os.path.join(base, spack, r"Midilatino_El_Despegue_F#_Min_92BPM\Midilatino_El_Despegue_F#_Min_92BPM_Reese.wav")),
    ("ML Synth",   os.path.join(base, spack, r"Midilatino_El_Despegue_F#_Min_92BPM\Midilatino_El_Despegue_F#_Min_92BPM_Synth.wav")),
]

for label, full in tests:
    if not os.path.exists(full):
        print(f"{label:15s} -> NOT FOUND")
        continue
    r = analyze_file(full)
    if r and "error" not in r:
        role = r["role"]
        char = r["character"]
        print(f"{label:15s} -> {role:12s} {char:10s} {r['new_name']}")
    else:
        print(f"{label:15s} -> ERROR: {r}")
