File size: 3,293 Bytes
51e419e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #!/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
|