#!/usr/bin/env python3
"""
Debug script for collaboration parsing issues
"""

import sys
sys.path.insert(0, '/app')

from src.api.database import MusicBrainzDatabase

def test_collaboration_parsing():
    db = MusicBrainzDatabase()
    
    # Test cases from the failed songs
    test_cases = [
        "ft Jamie Foxx West, Kanye",
        "Ariana Grande, Normani, Nicki Minaj", 
        "SZA, Justin Bieber",
        "Will.I.Am ft. Britney Spears",  # This should work now
        "Florida Georgia Line Ft Luke Bryan",  # This should work now
    ]
    
    print("🔍 Testing Collaboration Parsing")
    print("=" * 50)
    
    for artist_string in test_cases:
        print(f"\n📝 Input: '{artist_string}'")
        
        try:
            main_artist, collaborators = db._parse_complex_collaboration(artist_string)
            print(f"  ✅ Main artist: '{main_artist}'")
            print(f"  ✅ Collaborators: {collaborators}")
            
            if collaborators:
                print(f"  🎯 Parsed as collaboration")
            else:
                print(f"  ❌ Not detected as collaboration")
                
        except Exception as e:
            print(f"  ❌ Error: {e}")

if __name__ == "__main__":
    test_collaboration_parsing() 