#!/usr/bin/env python3 """ Test script to debug album download issues. Run this after the app is running to test album downloads. """ import requests import json import time def test_album_download(): """Test downloading an album through the API.""" # Test album data (example) test_album = { "url": "https://open.spotify.com/album/4aawyAB9vmqN3uQ7FjRGTy", # Random album "type": "album", "name": "Test Album", "artist": "Test Artist", "year": "2023", "tracks": 10 } print("๐Ÿงช Testing album download...") print(f"๐Ÿ“€ Album: {test_album['name']} by {test_album['artist']}") print(f"๐Ÿ”— URL: {test_album['url']}") try: # Send download request response = requests.post( 'http://localhost:6543/api/download', json=test_album, headers={'Content-Type': 'application/json'} ) if response.status_code == 200: result = response.json() print("โœ… Download request successful!") print(f"๐Ÿ“„ Response: {json.dumps(result, indent=2)}") else: print(f"โŒ Download request failed with status {response.status_code}") print(f"๐Ÿ“„ Response: {response.text}") except Exception as e: print(f"๐Ÿ’ฅ Error testing album download: {e}") if __name__ == "__main__": test_album_download()