#!/usr/bin/env python3 import os import sys from flask import Flask from flask_socketio import SocketIO, emit # Change to server directory to load the .env sys.path.insert(0, '/Volumes/SamMgmt/Containers/SamCloud Music App/server') os.chdir('/Volumes/SamMgmt/Containers/SamCloud Music App/server') app = Flask(__name__) socketio = SocketIO(app, cors_allowed_origins="*") @app.route('/status') def status(): return {"status": "ok", "message": "Simple test server running"} @socketio.on('search') def handle_test_search(data): print(f"🔍 Test search received: {data}") # Send back test results test_results = [ { "id": "test1", "name": "Test Song 1", "artist": "Test Artist", "album": "Test Album", "type": "track", "url": "https://spotify.com/test1", "image": "https://via.placeholder.com/64", "duration": 180000 }, { "id": "test2", "name": "Test Song 2", "artist": "Test Artist 2", "album": "Test Album 2", "type": "track", "url": "https://spotify.com/test2", "image": "https://via.placeholder.com/64", "duration": 210000 } ] print(f"📊 Sending test results: {len(test_results)} items") emit('search_results', {'results': test_results}) if __name__ == '__main__': print("🚀 Starting simple test server on port 5140...") socketio.run(app, host='0.0.0.0', port=5140, debug=True)