#!/bin/bash # Quick Start Script for Sinhala Subtitle Hardcoder # This script helps you set up and test the application locally echo "==============================================" echo "Sinhala Subtitle Hardcoder - Quick Start" echo "==============================================" echo "" # Function to check if command exists command_exists() { command -v "$1" >/dev/null 2>&1 } # Check Python echo "Checking Python..." if command_exists python3; then PYTHON_VERSION=$(python3 --version) echo "✅ $PYTHON_VERSION found" else echo "❌ Python 3 not found. Please install Python 3.8 or higher." exit 1 fi # Check pip echo "" echo "Checking pip..." if command_exists pip3; then echo "✅ pip3 found" else echo "❌ pip3 not found. Please install pip." exit 1 fi # Check FFmpeg echo "" echo "Checking FFmpeg..." if command_exists ffmpeg; then FFMPEG_VERSION=$(ffmpeg -version | head -n 1) echo "✅ $FFMPEG_VERSION found" else echo "❌ FFmpeg not found." echo "" echo "Install FFmpeg:" echo " Ubuntu/Debian: sudo apt-get install ffmpeg" echo " macOS: brew install ffmpeg" echo " Windows: Download from https://ffmpeg.org/" exit 1 fi # Check for Sinhala fonts echo "" echo "Checking Sinhala fonts..." if command_exists fc-list; then if fc-list :lang=si | grep -q "Noto\|Sinhala"; then echo "✅ Sinhala fonts found" else echo "⚠️ No Sinhala fonts found (optional but recommended)" echo "" echo "Install Noto fonts:" echo " Ubuntu/Debian: sudo apt-get install fonts-noto-core fonts-noto-extra" echo " macOS: brew install font-noto-sans" fi else echo "⚠️ fontconfig not found, cannot check fonts" fi # Install Python dependencies echo "" echo "==============================================" echo "Installing Python dependencies..." echo "==============================================" pip3 install -r requirements.txt if [ $? -eq 0 ]; then echo "✅ Dependencies installed successfully" else echo "❌ Failed to install dependencies" exit 1 fi # Run environment tests echo "" echo "==============================================" echo "Running environment tests..." echo "==============================================" python3 test_environment.py if [ $? -eq 0 ]; then echo "" echo "==============================================" echo "✅ All tests passed!" echo "==============================================" echo "" echo "To start the application, run:" echo " python3 app.py" echo "" echo "The app will be available at:" echo " http://localhost:7860" echo "" echo "Press Ctrl+C to stop the server" echo "==============================================" echo "" # Ask if user wants to start the app read -p "Start the application now? (y/n) " -n 1 -r echo "" if [[ $REPLY =~ ^[Yy]$ ]]; then echo "Starting application..." python3 app.py fi else echo "" echo "==============================================" echo "❌ Some tests failed" echo "==============================================" echo "" echo "Please fix the issues above before running the app." exit 1 fi