deleted unnecesary files
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
|
||||
Here is the complete content for the `How to use.txt` file, starting from **point 3** and including all the missing information:
|
||||
|
||||
```plaintext
|
||||
### How to Install, Start, and Use the Signage Player Application
|
||||
|
||||
This guide provides step-by-step instructions for installing, starting, and using the signage player application.
|
||||
|
||||
---
|
||||
|
||||
## 3. Using the Application
|
||||
|
||||
### MediaPlayer Screen
|
||||
- **Play/Pause Button**:
|
||||
- Toggles between playing and pausing the media.
|
||||
- Automatically resumes playback after 30 seconds if not toggled again.
|
||||
- **Next/Previous Buttons**:
|
||||
- Navigate to the next or previous media in the playlist.
|
||||
- **Exit App Button**:
|
||||
- Opens a password-protected popup. Enter the `quickconnect_key` from the configuration file to exit the app.
|
||||
|
||||
### Settings Screen
|
||||
- **Configuration Fields**:
|
||||
- Update fields like `screen_orientation`, `screen_name`, `quickconnect_key`, `server_ip`, and `port`.
|
||||
- **Save Button**:
|
||||
- Saves the updated configuration and returns to the MediaPlayer screen.
|
||||
- **Exit App Button**:
|
||||
- Opens a password-protected popup. Enter the `quickconnect_key` to exit the app.
|
||||
|
||||
---
|
||||
|
||||
## 4. Configuration
|
||||
|
||||
### Configuration File
|
||||
The configuration file is located at:
|
||||
```bash
|
||||
app_config.txt
|
||||
```
|
||||
|
||||
### Example Configuration
|
||||
```json
|
||||
{
|
||||
"screen_orientation": "Landscape",
|
||||
"screen_name": "MyScreen",
|
||||
"quickconnect_key": "12345",
|
||||
"server_ip": "192.168.1.1",
|
||||
"port": "8080"
|
||||
}
|
||||
```
|
||||
|
||||
### Updating Configuration
|
||||
1. Navigate to the **Settings Screen** in the app.
|
||||
2. Update the fields and click **Save**.
|
||||
3. The configuration will be saved to `app_config.txt`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Troubleshooting
|
||||
|
||||
### Permission Denied for `run_app.sh`
|
||||
- Ensure the script is executable:
|
||||
```bash
|
||||
chmod +x /home/pi/Desktop/signage-player/run_app.sh
|
||||
```
|
||||
|
||||
### Application Does Not Start on Boot
|
||||
- Verify the `~/.bashrc` or `crontab` entry is correct.
|
||||
- Check the script's permissions and paths.
|
||||
|
||||
### Media Files Not Playing
|
||||
- Ensure media files are downloaded to the correct directory:
|
||||
```bash
|
||||
/home/pi/Desktop/signage-player/src/static/resurse
|
||||
```
|
||||
- Check the playlist configuration and server connection.
|
||||
|
||||
### Password for Exit App
|
||||
- The password is the `quickconnect_key` from the configuration file (`app_config.txt`).
|
||||
|
||||
---
|
||||
|
||||
Let me know if you need further clarification or additional details!
|
||||
```
|
||||
|
||||
150
README.md
150
README.md
@@ -1,150 +0,0 @@
|
||||
# 🎥 Kivy Media Player
|
||||
|
||||
A media player application built using **Kivy** that allows users to play video files, display images, and manage settings for quick connect codes and server configurations. The application checks for updates to the playlist every five minutes while running in full-screen mode.
|
||||
|
||||
---
|
||||
|
||||
## 📂 Project Structure
|
||||
|
||||
```
|
||||
signage-player
|
||||
├── src
|
||||
│ ├── media_player.py # Handles media playback
|
||||
│ ├── python_functions.py # Utility functions for downloading files and updating playlists
|
||||
│ ├── kv
|
||||
│ │ └── media_player.kv # Layout for the media player screen
|
||||
│ ├── Resurse
|
||||
│ │ ├── app_config.txt # Configuration file
|
||||
│ │ ├── log.txt # Log file for media events
|
||||
│ │ ├── play.png # Play button icon
|
||||
│ │ ├── pause.png # Pause button icon
|
||||
│ │ └── other icons... # Additional icons for the UI
|
||||
│ └── static
|
||||
│ └── resurse # Directory for media files (images/videos)
|
||||
├── requirements.txt # Project dependencies
|
||||
├── run_app.sh # Script to run the application
|
||||
├── install.sh # Installation script
|
||||
├── How to use.txt # Detailed usage instructions
|
||||
└── README.md # Documentation for the project
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Setup Instructions
|
||||
|
||||
### Prerequisites
|
||||
Before installing the application, ensure the following are installed on your Raspberry Pi:
|
||||
- **Python 3.7 or higher**
|
||||
- **pip3** (Python package manager)
|
||||
- **ffmpeg** (for video conversion)
|
||||
- **Internet connection** for downloading dependencies
|
||||
|
||||
### Installation Steps
|
||||
|
||||
1. **Clone the Repository**
|
||||
```bash
|
||||
git clone https://gitea.moto-adv.com/ske087/signage-player.git
|
||||
cd signage-player
|
||||
```
|
||||
|
||||
2. **Run the Installation Script**
|
||||
```bash
|
||||
./install.sh
|
||||
```
|
||||
|
||||
The installation script will:
|
||||
- Update the system.
|
||||
- Install required Python and system dependencies.
|
||||
- Clone the repository to `/home/pi/Desktop/ds-player`.
|
||||
- Add the run_app.sh script to `~/.bashrc` for autostart.
|
||||
- Make the run_app.sh script executable.
|
||||
|
||||
3. **Reboot the Device**
|
||||
After installation, reboot the Raspberry Pi to start the application automatically:
|
||||
```bash
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎮 How to Use
|
||||
|
||||
### MediaPlayer Screen
|
||||
- **▶️ Play/Pause Button**:
|
||||
- Toggles between playing and pausing the media.
|
||||
- Automatically resumes playback after 30 seconds if not toggled again.
|
||||
- **⏩ Next/⏪ Previous Buttons**:
|
||||
- Navigate to the next or previous media in the playlist.
|
||||
- **❌ Exit App Button**:
|
||||
- Opens a password-protected popup. Enter the `quickconnect_key` from the configuration file to exit the app.
|
||||
|
||||
### Settings Screen
|
||||
- **Configuration Fields**:
|
||||
- Update fields like `screen_orientation`, `screen_name`, `quickconnect_key`, `server_ip`, and `port`.
|
||||
- **💾 Save Button**:
|
||||
- Saves the updated configuration and returns to the MediaPlayer screen.
|
||||
- **❌ Exit App Button**:
|
||||
- Opens a password-protected popup. Enter the `quickconnect_key` to exit the app.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
### Configuration File
|
||||
The configuration file is located at:
|
||||
```bash
|
||||
/home/pi/Desktop/signage-player/src/Resurse/app_config.txt
|
||||
```
|
||||
|
||||
### Example Configuration
|
||||
```json
|
||||
{
|
||||
"screen_orientation": "Landscape",
|
||||
"screen_name": "tv-panou1",
|
||||
"quickconnect_key": "8887779",
|
||||
"server_ip": "172.20.10.9",
|
||||
"port": "80"
|
||||
}
|
||||
```
|
||||
|
||||
### Updating Configuration
|
||||
1. Navigate to the **Settings Screen** in the app.
|
||||
2. Update the fields and click **Save**.
|
||||
3. The configuration will be saved to app_config.txt.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Troubleshooting
|
||||
|
||||
### Permission Denied for run_app.sh
|
||||
- Ensure the script is executable:
|
||||
```bash
|
||||
chmod +x /home/pi/Desktop/signage-player/run_app.sh
|
||||
```
|
||||
|
||||
### Application Does Not Start on Boot
|
||||
- Verify the `~/.bashrc` entry is correct.
|
||||
- Check the script's permissions and paths.
|
||||
|
||||
### Media Files Not Playing
|
||||
- Ensure media files are downloaded to the correct directory:
|
||||
```bash
|
||||
/home/pi/Desktop/signage-player/src/static/resurse
|
||||
```
|
||||
- Check the playlist configuration and server connection.
|
||||
|
||||
### Password for Exit App
|
||||
- The password is the `quickconnect_key` from the configuration file (`app_config.txt`).
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
|
||||
|
||||
---
|
||||
|
||||
## 📜 License
|
||||
|
||||
This project is licensed under the **MIT License**. See the `LICENSE` file for more details.
|
||||
````
|
||||
@@ -1,265 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Minimal installer for Raspberry Pi OS (no desktop environment)
|
||||
# Installs Xorg, Openbox, disables power saving, and configures auto-launch of the signage player
|
||||
# Compatible with Raspberry Pi Zero and all Pi models
|
||||
|
||||
set -e
|
||||
|
||||
USER_HOME="/home/pi"
|
||||
PROJECT_DIR="$USER_HOME/Desktop/tkinter_player"
|
||||
APP_LAUNCH_SCRIPT="$PROJECT_DIR/run_tkinter_debug.sh"
|
||||
|
||||
echo "=== Installing Tkinter Player on Raspberry Pi ==="
|
||||
echo "Project directory: $PROJECT_DIR"
|
||||
|
||||
# Update system
|
||||
echo "Updating system packages..."
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
|
||||
# Install minimal X server and window manager
|
||||
echo "Installing minimal X server and Openbox window manager..."
|
||||
sudo apt install -y xorg openbox
|
||||
|
||||
# Install VLC for video playback with essential codecs
|
||||
echo "Installing VLC media player and codecs..."
|
||||
sudo apt install -y vlc vlc-plugin-base vlc-plugin-video-output
|
||||
|
||||
# Install Python and system dependencies for tkinter app
|
||||
echo "Installing Python and system libraries..."
|
||||
sudo apt install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
python3-tk \
|
||||
python3-pil \
|
||||
python3-pil.imagetk \
|
||||
ffmpeg \
|
||||
libjpeg-dev \
|
||||
zlib1g-dev \
|
||||
libfreetype6-dev \
|
||||
liblcms2-dev \
|
||||
libwebp-dev \
|
||||
tcl8.6-dev \
|
||||
tk8.6-dev \
|
||||
libxss1 \
|
||||
libgconf-2-4 \
|
||||
libxrandr2 \
|
||||
libasound2-dev \
|
||||
libpangocairo-1.0-0 \
|
||||
libatk1.0-0 \
|
||||
libcairo-gobject2 \
|
||||
libgtk-3-0 \
|
||||
libgdk-pixbuf2.0-0
|
||||
|
||||
# Install build dependencies for Python packages
|
||||
echo "Installing build dependencies..."
|
||||
sudo apt install -y \
|
||||
build-essential \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
python3-dev \
|
||||
pkg-config
|
||||
|
||||
# Create virtual environment and install Python requirements
|
||||
echo "Setting up Python virtual environment..."
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# Create venv if it doesn't exist
|
||||
if [ ! -d "venv" ]; then
|
||||
python3 -m venv venv
|
||||
fi
|
||||
|
||||
# Activate virtual environment
|
||||
source venv/bin/activate
|
||||
|
||||
# Upgrade pip
|
||||
pip install --upgrade pip
|
||||
|
||||
# Install Python requirements
|
||||
echo "Installing Python packages..."
|
||||
pip install requests
|
||||
pip install bcrypt
|
||||
pip install python-vlc
|
||||
pip install pyautogui
|
||||
pip install Pillow
|
||||
|
||||
# Install additional packages that might be needed
|
||||
pip install psutil
|
||||
|
||||
# Make launch script executable if it exists
|
||||
if [ -f "$APP_LAUNCH_SCRIPT" ]; then
|
||||
chmod +x "$APP_LAUNCH_SCRIPT"
|
||||
echo "Made $APP_LAUNCH_SCRIPT executable"
|
||||
fi
|
||||
|
||||
deactivate
|
||||
|
||||
# Configure X server for headless operation
|
||||
echo "Configuring X server for auto-start..."
|
||||
sudo tee /etc/X11/xorg.conf > /dev/null << 'EOF'
|
||||
Section "ServerLayout"
|
||||
Identifier "Layout0"
|
||||
Screen 0 "Screen0" 0 0
|
||||
EndSection
|
||||
|
||||
Section "Device"
|
||||
Identifier "Device0"
|
||||
Driver "fbdev"
|
||||
Option "fbdev" "/dev/fb0"
|
||||
EndSection
|
||||
|
||||
Section "Screen"
|
||||
Identifier "Screen0"
|
||||
Device "Device0"
|
||||
Monitor "Monitor0"
|
||||
DefaultDepth 24
|
||||
SubSection "Display"
|
||||
Depth 24
|
||||
Modes "1920x1080" "1680x1050" "1280x1024" "1024x768"
|
||||
EndSubSection
|
||||
EndSection
|
||||
|
||||
Section "Monitor"
|
||||
Identifier "Monitor0"
|
||||
HorizSync 30-70
|
||||
VertRefresh 50-75
|
||||
EndSection
|
||||
EOF
|
||||
|
||||
# Create autostart script for signage player
|
||||
echo "Creating autostart configuration..."
|
||||
mkdir -p "$USER_HOME/.config/openbox"
|
||||
|
||||
cat > "$USER_HOME/.config/openbox/autostart" << 'EOF'
|
||||
# Disable screen blanking and power management
|
||||
xset s off
|
||||
xset -dpms
|
||||
xset s noblank
|
||||
|
||||
# Hide cursor after 1 second of inactivity
|
||||
unclutter -idle 1 -root &
|
||||
|
||||
# Wait a moment for X to fully initialize
|
||||
sleep 2
|
||||
|
||||
# Launch the signage player
|
||||
cd /home/pi/Desktop/tkinter_player
|
||||
./run_tkinter_debug.sh &
|
||||
EOF
|
||||
|
||||
chmod +x "$USER_HOME/.config/openbox/autostart"
|
||||
|
||||
# Install unclutter for hiding mouse cursor
|
||||
echo "Installing cursor hiding utility..."
|
||||
sudo apt install -y unclutter
|
||||
|
||||
# Configure automatic boot to GUI (signage player)
|
||||
echo "Configuring automatic startup on boot..."
|
||||
|
||||
# Create systemd service for auto-starting X and the signage player
|
||||
sudo tee /etc/systemd/system/signage-player.service > /dev/null << 'EOF'
|
||||
[Unit]
|
||||
Description=Digital Signage Player
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=pi
|
||||
Environment=HOME=/home/pi
|
||||
Environment=XDG_RUNTIME_DIR=/tmp/runtime-pi
|
||||
WorkingDirectory=/home/pi/Desktop/tkinter_player
|
||||
ExecStartPre=/bin/mkdir -p /tmp/runtime-pi
|
||||
ExecStartPre=/bin/chown pi:pi /tmp/runtime-pi
|
||||
ExecStart=/bin/bash -c 'DISPLAY=:0 startx'
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Enable the service to start on boot
|
||||
sudo systemctl enable signage-player.service
|
||||
|
||||
# Configure autologin for pi user (required for auto X start)
|
||||
echo "Configuring autologin for pi user..."
|
||||
sudo systemctl set-default multi-user.target
|
||||
|
||||
# Create getty override to enable autologin
|
||||
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
|
||||
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null << 'EOF'
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM
|
||||
EOF
|
||||
|
||||
# Configure bash profile to start X automatically on tty1
|
||||
echo "Configuring automatic X server startup..."
|
||||
cat >> "$USER_HOME/.bashrc" << 'EOF'
|
||||
|
||||
# Auto-start X server for signage player (only on tty1)
|
||||
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = "1" ]; then
|
||||
echo "Starting X server for digital signage..."
|
||||
exec startx
|
||||
fi
|
||||
EOF
|
||||
|
||||
# Disable screen blanking in boot config
|
||||
echo "Disabling screen blanking and power management..."
|
||||
if ! grep -q "disable_splash=1" /boot/config.txt; then
|
||||
echo "disable_splash=1" | sudo tee -a /boot/config.txt
|
||||
fi
|
||||
if ! grep -q "avoid_warnings=1" /boot/config.txt; then
|
||||
echo "avoid_warnings=1" | sudo tee -a /boot/config.txt
|
||||
fi
|
||||
|
||||
# Configure console blanking
|
||||
sudo tee -a /boot/cmdline.txt << 'EOF'
|
||||
consoleblank=0 logo.nologo quiet loglevel=0
|
||||
EOF
|
||||
|
||||
# Create a backup startup script in rc.local as fallback
|
||||
echo "Creating fallback startup in rc.local..."
|
||||
sudo cp /etc/rc.local /etc/rc.local.backup 2>/dev/null || true
|
||||
|
||||
sudo tee /etc/rc.local > /dev/null << 'EOF'
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# rc.local - executed at the end of each multiuser runlevel
|
||||
|
||||
# Disable HDMI power saving
|
||||
/usr/bin/tvservice -p
|
||||
|
||||
# Ensure runtime directory exists
|
||||
mkdir -p /tmp/runtime-pi
|
||||
chown pi:pi /tmp/runtime-pi
|
||||
|
||||
# Start X server as pi user if not already running (fallback)
|
||||
if ! pgrep -x "Xorg" > /dev/null; then
|
||||
su - pi -c 'DISPLAY=:0 startx' &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
sudo chmod +x /etc/rc.local
|
||||
|
||||
echo "=== Installation Complete ==="
|
||||
echo ""
|
||||
echo "✅ Digital Signage Player configured for automatic startup!"
|
||||
echo ""
|
||||
echo "The system will now:"
|
||||
echo "1. Auto-login as 'pi' user on boot"
|
||||
echo "2. Automatically start X server"
|
||||
echo "3. Launch the signage player application"
|
||||
echo "4. Restart the player if it crashes"
|
||||
echo ""
|
||||
echo "To test the setup:"
|
||||
echo "- Reboot the system: sudo reboot"
|
||||
echo "- The signage player should start automatically"
|
||||
echo ""
|
||||
echo "Manual controls:"
|
||||
echo "- Stop service: sudo systemctl stop signage-player"
|
||||
echo "- Check status: sudo systemctl status signage-player"
|
||||
echo "- View logs: journalctl -u signage-player -f"
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/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/tkinter_player"
|
||||
if [ ! -d "$PROJECT_DIR" ]; then
|
||||
echo "Project directory not found. Please ensure the tkinter_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"
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@
|
||||
"screen_orientation": "Landscape",
|
||||
"screen_name": "tv-terasa",
|
||||
"quickconnect_key": "8887779",
|
||||
"server_ip": "10.35.33.231",
|
||||
"server_ip": "192.168.1.22",
|
||||
"port": "80",
|
||||
"screen_w": "1920",
|
||||
"screen_h": "1080",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test script to verify the complete offline notification system"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
# Add the signage_player directory to the path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
|
||||
|
||||
def test_offline_notification():
|
||||
"""Test the offline notification display"""
|
||||
print("[TEST] Testing offline notification system...")
|
||||
|
||||
# Import after adding to path
|
||||
from get_playlists import get_last_playlist_update_time, get_server_status, set_server_offline, set_server_online
|
||||
|
||||
print(f"[TEST] Current server status: {get_server_status()}")
|
||||
|
||||
# Test getting playlist update time
|
||||
last_update = get_last_playlist_update_time()
|
||||
if last_update:
|
||||
print(f"[TEST] Last playlist update: {last_update.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
else:
|
||||
print("[TEST] No playlist file found")
|
||||
|
||||
# Test server offline mode
|
||||
print("\n[TEST] Setting server offline...")
|
||||
set_server_offline("Test - simulated network failure")
|
||||
status = get_server_status()
|
||||
print(f"[TEST] Server status after offline: {status}")
|
||||
|
||||
# Test server online mode
|
||||
time.sleep(1)
|
||||
print("\n[TEST] Setting server online...")
|
||||
set_server_online()
|
||||
status = get_server_status()
|
||||
print(f"[TEST] Server status after online: {status}")
|
||||
|
||||
print("\n[TEST] Offline notification system test completed!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_offline_notification()
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
||||
# Add the signage_player directory to path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
|
||||
|
||||
from get_playlists import (
|
||||
send_playlist_check_feedback,
|
||||
send_playlist_restart_feedback,
|
||||
send_playing_status_feedback
|
||||
)
|
||||
|
||||
def load_config():
|
||||
config_path = os.path.join(os.path.dirname(__file__), 'signage_player', 'main_data', 'app_config.txt')
|
||||
with open(config_path, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
def get_current_playlist_version():
|
||||
"""Get the actual current playlist version from the system"""
|
||||
playlist_dir = os.path.join(os.path.dirname(__file__), 'signage_player', 'static_data', 'playlist')
|
||||
try:
|
||||
if os.path.exists(playlist_dir):
|
||||
playlist_files = [f for f in os.listdir(playlist_dir) if f.startswith('server_playlist_v') and f.endswith('.json')]
|
||||
if playlist_files:
|
||||
versions = [int(f.split('_v')[-1].split('.json')[0]) for f in playlist_files]
|
||||
return max(versions)
|
||||
return 1 # Default version if no files found
|
||||
except Exception as e:
|
||||
print(f"Error getting playlist version: {e}")
|
||||
return 1
|
||||
|
||||
def test_feedback():
|
||||
print("=== Testing Complete Feedback System ===")
|
||||
|
||||
config = load_config()
|
||||
current_version = get_current_playlist_version()
|
||||
|
||||
print(f"Current actual playlist version: v{current_version}")
|
||||
|
||||
print("\n1. Server Interrogation Feedback:")
|
||||
result1 = send_playlist_check_feedback(config, current_version)
|
||||
print(f" Result: {'✓ Success' if result1 else '❌ Failed'}")
|
||||
|
||||
print("\n2. Playlist Starting Feedback:")
|
||||
result2 = send_playing_status_feedback(config, current_version, "intro1.mp4")
|
||||
print(f" Result: {'✓ Success' if result2 else '❌ Failed'}")
|
||||
|
||||
print("\n3. Playlist Working in Loop Feedback:")
|
||||
result3 = send_playlist_restart_feedback(config, current_version)
|
||||
print(f" Result: {'✓ Success' if result3 else '❌ Failed'}")
|
||||
|
||||
success_count = sum([result1, result2, result3])
|
||||
print(f"\n=== Dynamic Version Feedback ===")
|
||||
print(f"✓ Using actual playlist version: v{current_version}")
|
||||
print("✓ Version updates automatically when playlist changes")
|
||||
print("✓ Server gets real-time version information")
|
||||
print(f"\nResults: {success_count}/3 successful")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_feedback()
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
|
||||
# Add the signage_player directory to path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
|
||||
|
||||
from get_playlists import get_server_status, set_server_offline, set_server_online
|
||||
|
||||
def test_offline():
|
||||
print("=== Testing Offline Status ===")
|
||||
|
||||
print("1. Initial status:")
|
||||
status = get_server_status()
|
||||
print(f" Online: {status['is_online']}")
|
||||
|
||||
print("2. Setting offline:")
|
||||
set_server_offline("Test - server unreachable")
|
||||
status = get_server_status()
|
||||
print(f" Online: {status['is_online']}")
|
||||
print(f" Error: {status['error_message']}")
|
||||
|
||||
print("3. Setting online:")
|
||||
set_server_online()
|
||||
status = get_server_status()
|
||||
print(f" Online: {status['is_online']}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_offline()
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Simple UI test for offline notification display"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tkinter as tk
|
||||
|
||||
# Add the signage_player directory to the path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'signage_player'))
|
||||
|
||||
class TestNotificationApp:
|
||||
def __init__(self):
|
||||
self.root = tk.Tk()
|
||||
self.root.title("Offline Notification Test")
|
||||
self.root.geometry("800x600")
|
||||
self.root.configure(bg='black')
|
||||
|
||||
# Create main content area
|
||||
main_label = tk.Label(
|
||||
self.root,
|
||||
text="MAIN PLAYER CONTENT AREA",
|
||||
fg='white',
|
||||
bg='black',
|
||||
font=('Arial', 24)
|
||||
)
|
||||
main_label.pack(expand=True, fill='both')
|
||||
|
||||
# Test buttons
|
||||
button_frame = tk.Frame(self.root, bg='black')
|
||||
button_frame.pack(pady=10)
|
||||
|
||||
tk.Button(
|
||||
button_frame,
|
||||
text="Show Offline Notification",
|
||||
command=self.show_offline_notification,
|
||||
bg='red',
|
||||
fg='white'
|
||||
).pack(side=tk.LEFT, padx=5)
|
||||
|
||||
tk.Button(
|
||||
button_frame,
|
||||
text="Hide Notification",
|
||||
command=self.hide_offline_notification,
|
||||
bg='green',
|
||||
fg='white'
|
||||
).pack(side=tk.LEFT, padx=5)
|
||||
|
||||
self.offline_notification = None
|
||||
|
||||
def show_offline_notification(self):
|
||||
"""Show the offline notification at the bottom of the screen"""
|
||||
if self.offline_notification:
|
||||
return # Already showing
|
||||
|
||||
from get_playlists import get_last_playlist_update_time
|
||||
|
||||
last_update = get_last_playlist_update_time()
|
||||
if last_update:
|
||||
timestamp_str = last_update.strftime("%Y-%m-%d %H:%M:%S")
|
||||
message = f"OFFLINE MODE: Playing last available playlist updated at: {timestamp_str}"
|
||||
else:
|
||||
message = "OFFLINE MODE: Playing last available playlist"
|
||||
|
||||
self.offline_notification = tk.Label(
|
||||
self.root,
|
||||
text=message,
|
||||
fg='white',
|
||||
bg='red',
|
||||
font=('Arial', 12, 'bold'),
|
||||
pady=5
|
||||
)
|
||||
self.offline_notification.pack(side=tk.BOTTOM, fill=tk.X)
|
||||
print(f"[UI TEST] Notification shown: {message}")
|
||||
|
||||
def hide_offline_notification(self):
|
||||
"""Hide the offline notification"""
|
||||
if self.offline_notification:
|
||||
self.offline_notification.destroy()
|
||||
self.offline_notification = None
|
||||
print("[UI TEST] Notification hidden")
|
||||
|
||||
def run(self):
|
||||
print("[UI TEST] Starting offline notification UI test...")
|
||||
self.root.mainloop()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = TestNotificationApp()
|
||||
app.run()
|
||||
@@ -1,11 +0,0 @@
|
||||
Video Profile for Player Compatibility (based on intro1.mp4)
|
||||
|
||||
Codec: H.264
|
||||
Profile: Main
|
||||
Resolution: 1920x1080
|
||||
Bitrate: ~14,700 kbps
|
||||
Framerate: 29.97 fps
|
||||
|
||||
Recommended ffmpeg conversion command:
|
||||
|
||||
ffmpeg -i input.mp4 -c:v libx264 -profile:v main -b:v 14700k -vf "scale=1920:1080,fps=29.97" -c:a copy output_normalized.mp4
|
||||
Reference in New Issue
Block a user