Updated SH file
This commit is contained in:
57
Install.sh
Normal file
57
Install.sh
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# filepath: /home/pi/Desktop/signage-player/install.sh
|
||||||
|
|
||||||
|
# Define variables
|
||||||
|
REPO_URL="https://gitea.moto-adv.com/ske087/signage-player.git"
|
||||||
|
INSTALL_DIR="/home/pi/signage-player"
|
||||||
|
|
||||||
|
# Update system packages
|
||||||
|
echo "Updating system packages..."
|
||||||
|
sudo apt update && sudo apt upgrade -y
|
||||||
|
# Install SDL2 and related libraries
|
||||||
|
sudo apt install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
|
||||||
|
|
||||||
|
# Install OpenGL ES and EGL libraries
|
||||||
|
sudo apt install -y libgles2-mesa-dev libegl1-mesa-dev
|
||||||
|
|
||||||
|
# Install GStreamer and related plugins
|
||||||
|
sudo apt install -y libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav
|
||||||
|
|
||||||
|
# Install X11 libraries
|
||||||
|
sudo apt install -y libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev
|
||||||
|
|
||||||
|
# Install framebuffer support
|
||||||
|
sudo apt install -y libmtdev-dev
|
||||||
|
|
||||||
|
# install Python3
|
||||||
|
sudo apt install -y python3
|
||||||
|
|
||||||
|
# Install required system packages
|
||||||
|
echo "Installing required system packages..."
|
||||||
|
sudo apt install -y python3 python3-pip git
|
||||||
|
|
||||||
|
# Clone the repository
|
||||||
|
echo "Cloning the repository..."
|
||||||
|
if [ -d "$INSTALL_DIR" ]; then
|
||||||
|
echo "Directory $INSTALL_DIR already exists. Removing it..."
|
||||||
|
sudo rm -rf "$INSTALL_DIR"
|
||||||
|
fi
|
||||||
|
git clone "$REPO_URL" "$INSTALL_DIR"
|
||||||
|
|
||||||
|
# Navigate to the cloned repository
|
||||||
|
cd "$INSTALL_DIR" || exit
|
||||||
|
|
||||||
|
# Install Python dependencies
|
||||||
|
echo "Installing Python dependencies..."
|
||||||
|
pip3 install -r requirements.txt --break-system-packages
|
||||||
|
|
||||||
|
# Set permissions for the run_app.sh script
|
||||||
|
echo "Setting permissions for run_app.sh..."
|
||||||
|
chmod +x "$INSTALL_DIR/run_app.sh"
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
echo "Launching the application..."
|
||||||
|
"$INSTALL_DIR/run_app.sh --verbose"
|
||||||
|
|
||||||
|
echo "Installation and setup complete!"
|
||||||
67
install.sh
67
install.sh
@@ -1,67 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Define variables
|
|
||||||
REPO_URL="https://gitea.moto-adv.com/ske087/signage-player.git" # Replace with your Gitea repository URL
|
|
||||||
PROJECT_DIR="/home/pi/Desktop/ds-player" # Full path to the installation folder
|
|
||||||
RUN_SCRIPT="$PROJECT_DIR/run_app.sh" # Path to the run_app.sh script
|
|
||||||
|
|
||||||
# Step 0: Check if an internet connection exists
|
|
||||||
echo "Checking internet connection..."
|
|
||||||
if ! ping -c 1 google.com &> /dev/null; then
|
|
||||||
echo "No internet connection detected. Please ensure the device is connected to the internet."
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Internet connection is active."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 1: Check if the installation folder exists
|
|
||||||
if [ -d "$PROJECT_DIR" ]; then
|
|
||||||
echo "Installation folder already exists: $PROJECT_DIR"
|
|
||||||
echo "Skipping installation steps..."
|
|
||||||
else
|
|
||||||
# Step 2: Update the system
|
|
||||||
echo "Updating the system..."
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get upgrade -y
|
|
||||||
|
|
||||||
# Step 3: Clone the repository
|
|
||||||
echo "Cloning the repository from $REPO_URL..."
|
|
||||||
git clone "$REPO_URL" "$PROJECT_DIR"
|
|
||||||
|
|
||||||
# Step 4: Set permissions for the project directory
|
|
||||||
echo "Setting permissions for the project directory to 0777..."
|
|
||||||
sudo chmod -R 0777 "$PROJECT_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 5: Navigate to the project directory
|
|
||||||
cd "$PROJECT_DIR" || { echo "Failed to navigate to project directory."; exit 1; }
|
|
||||||
|
|
||||||
# Step 6: Install Python dependencies
|
|
||||||
echo "Installing Python dependencies..."
|
|
||||||
sudo apt-get install -y python3-pip
|
|
||||||
pip3 install --upgrade pip
|
|
||||||
pip3 install -r requirements.txt --break-system-packages
|
|
||||||
|
|
||||||
# Step 7: Install system dependencies for ffpyplayer
|
|
||||||
echo "Installing system dependencies for ffpyplayer..."
|
|
||||||
sudo apt-get install -y libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev \
|
|
||||||
libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libpostproc-dev \
|
|
||||||
libavcodec-extra libavdevice-dev libavfilter-dev
|
|
||||||
|
|
||||||
# Step 8: Add run_app.sh to ~/.bashrc for autostart
|
|
||||||
echo "Adding $RUN_SCRIPT to ~/.bashrc for autostart..."
|
|
||||||
if ! grep -Fxq "$RUN_SCRIPT" ~/.bashrc; then
|
|
||||||
echo "$RUN_SCRIPT" >> ~/.bashrc
|
|
||||||
echo "Added $RUN_SCRIPT to ~/.bashrc."
|
|
||||||
else
|
|
||||||
echo "$RUN_SCRIPT is already in ~/.bashrc."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 9: Make run_app.sh executable
|
|
||||||
echo "Making $RUN_SCRIPT executable..."
|
|
||||||
chmod +x "$RUN_SCRIPT"
|
|
||||||
|
|
||||||
# Step 10: Confirm installation
|
|
||||||
echo "Installation completed successfully!"
|
|
||||||
echo "The application will now start automatically when the device starts."
|
|
||||||
echo "You can manually run the application using: $RUN_SCRIPT"
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# filepath: /home/pi/Desktop/signage-player/run_app.sh
|
# filepath: /home/pi/Desktop/signage-player/run_app.sh
|
||||||
|
|
||||||
# Navigate to the application directory
|
# Navigate to the application directory
|
||||||
cd /home/pi/Desktop/signage-player/src || exit
|
cd /home/pi/signage-player/src || exit
|
||||||
|
|
||||||
# Check for the --verbose flag
|
# Check for the --verbose flag
|
||||||
if [[ "$1" == "--verbose" ]]; then
|
if [[ "$1" == "--verbose" ]]; then
|
||||||
|
|||||||
@@ -11,3 +11,5 @@
|
|||||||
2025-06-19 16:06:03 - STARTED: IMG-20250602-WA0011.jpg
|
2025-06-19 16:06:03 - STARTED: IMG-20250602-WA0011.jpg
|
||||||
2025-06-19 16:06:23 - STARTED: IMG_20250601_192845.jpg
|
2025-06-19 16:06:23 - STARTED: IMG_20250601_192845.jpg
|
||||||
2025-06-19 16:06:43 - STARTED: IMG_20250601_185017.jpg
|
2025-06-19 16:06:43 - STARTED: IMG_20250601_185017.jpg
|
||||||
|
2025-06-19 16:39:23 - STARTED: IMG-20250526-WA0003.jpg
|
||||||
|
2025-06-19 16:39:23 - STARTED: IMG-20250602-WA0011.jpg
|
||||||
|
|||||||
Binary file not shown.
@@ -49,6 +49,12 @@ Logger.info(f"python_functions: Configuration status: {config_status}")
|
|||||||
|
|
||||||
def load_playlist():
|
def load_playlist():
|
||||||
"""Load playlist from the server or local storage."""
|
"""Load playlist from the server or local storage."""
|
||||||
|
# Check if the local playlist exists and is valid
|
||||||
|
local_playlist = load_local_playlist()
|
||||||
|
if local_playlist:
|
||||||
|
Logger.info("python_functions: Using local playlist.")
|
||||||
|
return local_playlist # Skip server download if local playlist is valid
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Logger.info("python_functions: Attempting to load playlist from server...")
|
Logger.info("python_functions: Attempting to load playlist from server...")
|
||||||
server_ip = f'{server}:{port}' # Construct the server IP with port
|
server_ip = f'{server}:{port}' # Construct the server IP with port
|
||||||
@@ -91,7 +97,7 @@ def load_playlist():
|
|||||||
Logger.error(f"python_functions: Failed to load playlist: {e}")
|
Logger.error(f"python_functions: Failed to load playlist: {e}")
|
||||||
|
|
||||||
# Fallback to local playlist
|
# Fallback to local playlist
|
||||||
return load_local_playlist()
|
return local_playlist
|
||||||
|
|
||||||
|
|
||||||
def load_local_playlist():
|
def load_local_playlist():
|
||||||
|
|||||||
Reference in New Issue
Block a user