#!/usr/bin/env python3
"""
Test script for the specific failed collaboration songs
"""

import sys
import json
from pathlib import Path

# Add the src directory to the path
sys.path.insert(0, '/app')
from src.cli.main import MusicBrainzCleaner

def main():
    print('🔍 Testing Failed Collaboration Songs...')
    
    # Create test songs from the failed ones
    failed_songs = [
        {
            "artist": "ft Jamie Foxx West, Kanye",
            "title": "Gold Digger"
        },
        {
            "artist": "Ariana Grande, Normani, Nicki Minaj",
            "title": "Bad To You"
        },
        {
            "artist": "SZA, Justin Bieber",
            "title": "Snooze (Acoustic)"
        }
    ]
    
    # Initialize cleaner
    cleaner = MusicBrainzCleaner()
    
    print(f'🎯 Testing {len(failed_songs)} collaboration songs...')
    
    for i, song in enumerate(failed_songs, 1):
        print(f'\n  [{i}/{len(failed_songs)}] Processing: "{song["artist"]}" - "{song["title"]}"')
        
        try:
            result = cleaner.clean_song(song)
            cleaned_song, success = result
            
            artist_found = 'mbid' in cleaned_song
            recording_found = 'recording_mbid' in cleaned_song
            
            if artist_found and recording_found:
                print(f'      ✅ Found both artist and recording')
                print(f'      🎯 Artist: {cleaned_song.get("artist", "Unknown")} (MBID: {cleaned_song.get("mbid", "None")})')
                print(f'      🎯 Recording: {cleaned_song.get("recording_mbid", "None")}')
            elif artist_found:
                print(f'      ⚠️  Artist found but recording not found')
                print(f'      🎯 Artist: {cleaned_song.get("artist", "Unknown")} (MBID: {cleaned_song.get("mbid", "None")})')
            else:
                print(f'      ❌ Neither artist nor recording found')
                
        except Exception as e:
            print(f'      ❌ Error: {e}')

if __name__ == "__main__":
    main() 