68 lines
2.0 KiB
Bash
Executable File
68 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Tkinter Media Player Installation Script
|
|
|
|
echo "Installing Tkinter Media Player..."
|
|
|
|
# Update system packages
|
|
echo "Updating system packages..."
|
|
sudo apt update
|
|
sudo apt upgrade -y
|
|
|
|
# Install system dependencies
|
|
echo "Installing system dependencies..."
|
|
sudo apt install -y python3 python3-pip python3-venv python3-tk
|
|
sudo apt install -y ffmpeg libopencv-dev python3-opencv
|
|
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev libsdl2-ttf-dev
|
|
sudo apt install -y libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev
|
|
|
|
# Create project directory if it doesn't exist
|
|
PROJECT_DIR="/home/pi/Desktop/signage-player"
|
|
if [ ! -d "$PROJECT_DIR" ]; then
|
|
echo "Project directory not found. Please ensure the signage-player directory exists."
|
|
exit 1
|
|
fi
|
|
|
|
cd "$PROJECT_DIR"
|
|
|
|
# Create virtual environment
|
|
echo "Creating Python virtual environment..."
|
|
python3 -m venv venv
|
|
|
|
# Activate virtual environment and install requirements
|
|
echo "Installing Python dependencies..."
|
|
source venv/bin/activate
|
|
pip install --upgrade pip
|
|
pip install -r tkinter_requirements.txt
|
|
deactivate
|
|
|
|
# Make launcher script executable
|
|
chmod +x run_tkinter_app.sh
|
|
|
|
# Create systemd service for auto-start
|
|
echo "Creating systemd service..."
|
|
sudo tee /etc/systemd/system/tkinter-signage-player.service > /dev/null <<EOF
|
|
[Unit]
|
|
Description=Tkinter Signage Player
|
|
After=graphical-session.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=pi
|
|
Environment=DISPLAY=:0
|
|
ExecStart=/home/pi/Desktop/signage-player/run_tkinter_app.sh
|
|
Restart=always
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=graphical-session.target
|
|
EOF
|
|
|
|
# Enable the service
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable tkinter-signage-player.service
|
|
|
|
echo "Installation completed!"
|
|
echo "The tkinter media player will start automatically on boot."
|
|
echo "To start manually, run: ./run_tkinter_app.sh"
|
|
echo "To stop the service: sudo systemctl stop tkinter-signage-player.service"
|
|
echo "To view logs: sudo journalctl -u tkinter-signage-player.service -f" |