From 96f9118362eb079bc926eb2ffaa1c5c19a9177e3 Mon Sep 17 00:00:00 2001 From: Kivy Signage Player Date: Mon, 3 Nov 2025 16:57:40 +0200 Subject: [PATCH] Add start.sh script for easy startup with virtual environment Features: - Automatically activates .venv virtual environment - Creates venv if it doesn't exist - Installs dependencies on first run - Checks for configuration file - Changes to project directory automatically - Deactivates venv on exit Usage: bash start.sh Updated README with new recommended startup method. --- README.md | 24 +++++++++++++++++++---- start.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) create mode 100755 start.sh diff --git a/README.md b/README.md index 64ab233..bf4c9b5 100644 --- a/README.md +++ b/README.md @@ -35,18 +35,34 @@ A modern digital signage player built with Kivy framework that displays content ## Usage -### Manual Start +### Recommended: Using Start Script (with Virtual Environment) ```bash -cd src -python3 main.py +chmod +x start.sh +./start.sh ``` +This script automatically: +- Activates the Python virtual environment +- Checks for configuration +- Starts the player -### Using Run Script +### Alternative: Using Run Script ```bash chmod +x run_player.sh ./run_player.sh ``` +### Manual Start +```bash +# With virtual environment +source .venv/bin/activate +cd src +python3 main.py + +# Without virtual environment +cd src +python3 main.py +``` + ## Controls - **Mouse/Touch Movement**: Shows control panel for 3 seconds diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..73fe33b --- /dev/null +++ b/start.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Kivy Signage Player Startup Script +# This script activates the virtual environment and starts the player + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "==========================================" +echo "Starting Kivy Signage Player" +echo "==========================================" +echo "" + +# Change to the project directory +cd "$SCRIPT_DIR" +echo "Project directory: $SCRIPT_DIR" + +# Check if virtual environment exists +if [ -d ".venv" ]; then + echo "Activating virtual environment..." + source .venv/bin/activate + echo "✓ Virtual environment activated" +else + echo "Warning: Virtual environment not found at .venv/" + echo "Creating virtual environment..." + python3 -m venv .venv + source .venv/bin/activate + echo "Installing dependencies..." + pip3 install -r requirements.txt + echo "✓ Virtual environment created and dependencies installed" +fi + +echo "" + +# Check if configuration exists +if [ ! -f "config/app_config.txt" ]; then + echo "==========================================" + echo "⚠ WARNING: Configuration file not found!" + echo "==========================================" + echo "" + echo "Please configure the player before running:" + echo " 1. Copy config/app_config.txt.example to config/app_config.txt" + echo " 2. Edit the configuration file with your server details" + echo "" + read -p "Press Enter to continue anyway, or Ctrl+C to exit..." + echo "" +fi + +# Change to src directory and start the application +echo "Starting application..." +echo "==========================================" +echo "" + +cd src +python3 main.py + +# Deactivate virtual environment when app exits +deactivate