#!/bin/bash # Quick comparison script echo "╔═══════════════════════════════════════════════════════════════╗" echo "║ Python vs Rust - track_getFileUrl Comparison ║" echo "╚═══════════════════════════════════════════════════════════════╝" echo "" echo "This script will help you compare the exact requests sent by" echo "Python (working) vs Rust (failing) to find the difference." echo "" echo "Prerequisites:" echo " - Terminal 1: Run fake_qobuz_server.py" echo " - Terminal 2: Run this script" echo "" read -p "Press Enter when fake server is running in Terminal 1..." echo "" echo "══════════════════════════════════════════════════════════════" echo " STEP 1: Testing Python" echo "══════════════════════════════════════════════════════════════" echo "" # Patch for fake server echo "→ Patching raw.py to use localhost:8080..." python3 patch_for_fake.py echo "" echo "→ Running Python test..." echo " (Watch Terminal 1 for the /track/getFileUrl request!)" echo "" python3 test_getfileurl.py echo "" echo "→ Restoring raw.py..." python3 patch_for_fake.py restore echo "" echo "══════════════════════════════════════════════════════════════" echo " Python test complete!" echo "══════════════════════════════════════════════════════════════" echo "" echo "Did you see the /track/getFileUrl request in Terminal 1?" echo "Make sure to COPY or SCREENSHOT it!" echo "" read -p "Press Enter when ready to test Rust..." echo "" echo "══════════════════════════════════════════════════════════════" echo " STEP 2: Testing Rust" echo "══════════════════════════════════════════════════════════════" echo "" echo "⚠️ MANUAL STEP REQUIRED:" echo "" echo "1. Edit pmoqobuz/src/api/mod.rs line ~32:" echo " Change: const API_BASE_URL: &str = \"https://www.qobuz.com/api.json/0.2\";" echo " To: const API_BASE_URL: &str = \"http://localhost:8080/api.json/0.2\";" echo "" echo "2. Compile and run:" echo " cd .." echo " cargo run --example lazy_loading" echo "" echo "3. Watch Terminal 1 for the /track/getFileUrl request!" echo "" echo "4. COMPARE with Python request!" echo "" echo "5. Don't forget to restore the URL in mod.rs when done!" echo "" echo "══════════════════════════════════════════════════════════════" echo " Comparison tips:" echo "══════════════════════════════════════════════════════════════" echo "" echo "Look for differences in:" echo " • Order of form parameters" echo " • Format of request_ts (timestamp)" echo " • Presence of headers (Content-Type, etc.)" echo " • Encoding of form data" echo "" echo "See COMPARISON_GUIDE.md for detailed instructions." echo ""