import sys
import os
sys.path.insert(0, r"C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server")

from sample_selector import SampleSelector

class MockSample:
    def __init__(self, name, sample_id, duration=1.0, rating=3.0, bpm=None, key=None,
                 category='drums', sample_type='kick', path='/test/', spectral_centroid=5000.0,
                 rms_energy=0.5, genres=None):
        self.name = name
        self.id = sample_id
        self.duration = duration
        self.rating = rating
        self.bpm = bpm
        self.key = key
        self.category = category
        self.sample_type = sample_type
        self.path = path + name if not path.endswith(name) else path
        self.file_path = self.path
        self.spectral_centroid = spectral_centroid
        self.rms_energy = rms_energy
        self.genres = genres or []
        self.subcategory = sample_type

print("INIT")
selector = SampleSelector()
sample = MockSample("kick_808.wav", "sample_1", rating=4.0, bpm=128, key="Am")

print("ABOUT TO CALL")
import trace
tracer = trace.Trace(count=False, trace=True, ignoredirs=[sys.prefix, sys.exec_prefix])
tracer.runfunc(selector._calculate_sample_score, sample, target_key="Am", target_bpm=128, target_role="kick", target_genre="techno", prefer_oneshot=True)
print("DONE")
