Initial import: clean snapshot from /home/olafn/infoscreen-dev (2025-10-25)

This commit is contained in:
RobbStarkAustria
2025-10-25 17:42:27 +02:00
commit 8ca9f69f6f
111 changed files with 8612 additions and 0 deletions

210
scripts/test-display-manager.sh Executable file
View File

@@ -0,0 +1,210 @@
#!/bin/bash
# Test Display Manager functionality
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
EVENT_FILE="$PROJECT_ROOT/src/current_event.json"
echo "🧪 Testing Display Manager"
echo "========================="
echo ""
# Function to create test event
create_test_event() {
local event_type=$1
echo "📝 Creating test event: $event_type"
case $event_type in
"presentation")
cat > "$EVENT_FILE" <<EOF
{
"id": 999,
"title": "Test Presentation with Impressive",
"start": "2025-01-01 00:00:00",
"end": "2025-12-31 23:59:59",
"presentation": {
"type": "slideshow",
"files": [
{
"name": "LPUV4I_Folien_Nowitzki_Bewertungskriterien.pptx",
"url": "http://example.com/test.pptx"
}
],
"auto_advance": true,
"slide_interval": 5,
"loop": true
}
}
EOF
;;
"webpage")
cat > "$EVENT_FILE" <<EOF
{
"id": 998,
"title": "Test Webpage",
"start": "2025-01-01 00:00:00",
"end": "2025-12-31 23:59:59",
"web": {
"url": "https://www.wikipedia.org"
}
}
EOF
;;
"video")
cat > "$EVENT_FILE" <<EOF
{
"id": 997,
"title": "Test Video",
"start": "2025-01-01 00:00:00",
"end": "2025-12-31 23:59:59",
"video": {
"url": "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
"loop": false
}
}
EOF
;;
"none")
echo "📝 Removing event file (no active event)"
rm -f "$EVENT_FILE"
;;
esac
if [ -f "$EVENT_FILE" ]; then
echo "✅ Event file created:"
cat "$EVENT_FILE"
fi
echo ""
}
# Function to check if display manager is running
check_display_manager() {
if pgrep -f "display_manager.py" > /dev/null; then
echo "✅ Display Manager is running"
echo " PID: $(pgrep -f display_manager.py)"
return 0
else
echo "❌ Display Manager is NOT running"
return 1
fi
}
# Function to check for display processes
check_display_processes() {
echo "🔍 Active display processes:"
# Check for LibreOffice
if pgrep -f "libreoffice.*impress" > /dev/null; then
echo " 📊 LibreOffice Impress: PID $(pgrep -f 'libreoffice.*impress')"
fi
# Check for browsers
if pgrep -f "chromium.*kiosk" > /dev/null; then
echo " 🌐 Chromium (kiosk): PID $(pgrep -f 'chromium.*kiosk')"
fi
# Check for video players
if pgrep -f "vlc" > /dev/null; then
echo " 🎬 VLC: PID $(pgrep -f 'vlc')"
fi
if pgrep -f "mpv" > /dev/null; then
echo " 🎬 MPV: PID $(pgrep -f 'mpv')"
fi
# Check for PDF viewers
if pgrep -f "evince" > /dev/null; then
echo " 📄 Evince: PID $(pgrep -f 'evince')"
fi
# Check for Impressive
if pgrep -f "impressive" > /dev/null; then
echo " 📊 Impressive: PID $(pgrep -f 'impressive')"
fi
echo ""
}
# Main menu
echo "Display Manager Test Menu"
echo "========================="
echo ""
echo "What would you like to test?"
echo "1) Check Display Manager status"
echo "2) Create PRESENTATION test event"
echo "3) Create WEBPAGE test event"
echo "4) Create VIDEO test event"
echo "5) Remove event (no display)"
echo "6) Check active display processes"
echo "7) View current event file"
echo "8) Interactive test (cycle through events)"
echo "9) Exit"
echo ""
read -p "Enter choice [1-9]: " choice
case $choice in
1)
check_display_manager
check_display_processes
;;
2)
create_test_event "presentation"
echo "⏱️ Display Manager will pick this up within 5 seconds..."
;;
3)
create_test_event "webpage"
echo "⏱️ Display Manager will pick this up within 5 seconds..."
;;
4)
create_test_event "video"
echo "⏱️ Display Manager will pick this up within 5 seconds..."
;;
5)
create_test_event "none"
echo "⏱️ Display Manager will stop display within 5 seconds..."
;;
6)
check_display_manager
check_display_processes
;;
7)
if [ -f "$EVENT_FILE" ]; then
echo "📄 Current event file:"
cat "$EVENT_FILE"
else
echo "❌ No event file found"
fi
;;
8)
echo "🔄 Interactive test - cycling through event types"
echo " Display Manager must be running for this test!"
echo ""
check_display_manager || exit 1
echo "1⃣ Testing PRESENTATION (10 seconds)..."
create_test_event "presentation"
sleep 10
echo "2⃣ Testing WEBPAGE (10 seconds)..."
create_test_event "webpage"
sleep 10
echo "3⃣ Testing NO EVENT (5 seconds)..."
create_test_event "none"
sleep 5
echo "4⃣ Back to PRESENTATION..."
create_test_event "presentation"
echo "✅ Interactive test complete!"
;;
9)
echo "👋 Goodbye!"
exit 0
;;
*)
echo "❌ Invalid choice"
exit 1
;;
esac