#!/bin/bash # TechDJ PyQt5 Launcher Script echo "🎧 TechDJ PyQt5 - Native DJ Application" echo "========================================" echo "" # Check if Python is installed if ! command -v python3 &> /dev/null; then echo "❌ Python 3 is not installed!" echo "Please install Python 3 first." exit 1 fi echo "✅ Python 3 found: $(python3 --version)" # Check if pip is installed if ! command -v pip3 &> /dev/null; then echo "⚠️ pip3 not found. Installing..." echo "Please run: sudo apt install python3-pip" exit 1 fi # Check if dependencies are installed echo "" echo "Checking dependencies..." MISSING_DEPS=0 # Check PyQt5 if ! python3 -c "import PyQt5" 2>/dev/null; then echo "❌ PyQt5 not installed" MISSING_DEPS=1 else echo "✅ PyQt5 installed" fi # Check sounddevice if ! python3 -c "import sounddevice" 2>/dev/null; then echo "❌ sounddevice not installed" MISSING_DEPS=1 else echo "✅ sounddevice installed" fi # Check soundfile if ! python3 -c "import soundfile" 2>/dev/null; then echo "❌ soundfile not installed" MISSING_DEPS=1 else echo "✅ soundfile installed" fi # Check numpy if ! python3 -c "import numpy" 2>/dev/null; then echo "❌ numpy not installed" MISSING_DEPS=1 else echo "✅ numpy installed" fi # Check socketio if ! python3 -c "import socketio" 2>/dev/null; then echo "❌ python-socketio not installed" MISSING_DEPS=1 else echo "✅ python-socketio installed" fi # Install missing dependencies if [ $MISSING_DEPS -eq 1 ]; then echo "" echo "📦 Installing missing dependencies..." echo "This may take a few minutes..." echo "" # Install system dependencies first (for sounddevice) echo "Installing system dependencies..." if command -v apt-get &> /dev/null; then echo "Detected Debian/Ubuntu system" echo "You may need to run: sudo apt-get install portaudio19-dev python3-pyqt5" elif command -v dnf &> /dev/null; then echo "Detected Fedora system" echo "You may need to run: sudo dnf install portaudio-devel python3-qt5" elif command -v pacman &> /dev/null; then echo "Detected Arch system" echo "You may need to run: sudo pacman -S portaudio python-pyqt5" fi echo "" echo "Installing Python packages..." pip3 install --user PyQt5 sounddevice soundfile numpy python-socketio[client] requests if [ $? -ne 0 ]; then echo "❌ Installation failed!" echo "Please install dependencies manually:" echo " pip3 install --user -r requirements.txt" exit 1 fi echo "✅ Dependencies installed successfully!" fi # Check if Flask server is running echo "" echo "Checking Flask server..." if curl -s http://localhost:5000/library.json > /dev/null 2>&1; then echo "✅ Flask server is running on port 5000" else echo "⚠️ Flask server not detected on port 5000" echo "Please start the server first:" echo " python3 server.py" echo "" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi # Launch the application echo "" echo "🚀 Launching TechDJ PyQt5..." echo "" python3 techdj_qt.py echo "" echo "👋 TechDJ PyQt5 closed"