diff --git a/app/__pycache__/app.cpython-312.pyc b/app/__pycache__/app.cpython-312.pyc old mode 100755 new mode 100644 index e22e1ee..d4b45bd Binary files a/app/__pycache__/app.cpython-312.pyc and b/app/__pycache__/app.cpython-312.pyc differ diff --git a/app/app.py b/app/app.py index 4fe6c75..a1e1979 100755 --- a/app/app.py +++ b/app/app.py @@ -4,6 +4,8 @@ import os import json import requests import logging +import threading +import time # Configure logging logging.basicConfig(level=logging.INFO) @@ -217,7 +219,27 @@ def initialize_playlist(): download_playlist_files_from_server() Logger.info("Playlist initialization complete.") +# Function to check for playlist updates every 5 minutes +def periodic_playlist_check(): + while True: + try: + Logger.info("Checking for playlist updates...") + # Download the playlist files from the server + download_playlist_files_from_server() + # Create the updated playlist with local file paths + create_updated_playlist() + Logger.info("Playlist check complete.") + except Exception as e: + Logger.error(f"Error during playlist check: {e}") + time.sleep(300) # Wait for 5 minutes (300 seconds) before checking again + +# Start the periodic playlist check in a background thread +def start_playlist_check_thread(): + thread = threading.Thread(target=periodic_playlist_check, daemon=True) + thread.start() + if __name__ == '__main__': initialize_playlist() # Check and download playlist on startup create_updated_playlist() # Create the updated playlist + start_playlist_check_thread() # Start the background thread for periodic checks app.run(host='0.0.0.0', port=1025) \ No newline at end of file diff --git a/app/run_app.sh b/app/run_app.sh new file mode 100644 index 0000000..c1196f9 --- /dev/null +++ b/app/run_app.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status +set -e + +# Activate the virtual environment +source venv/bin/activate + +# Run the Gunicorn server +echo "Starting Gunicorn server..." +python3 run_gunicorn.py & + +# Wait for 5 seconds to ensure the server is up +sleep 5 + +# Launch Chromium in fullscreen and kiosk mode +echo "Launching Chromium in fullscreen and kiosk mode..." +chromium-browser --kiosk --start-fullscreen http://localhost:1025 + +# Deactivate the virtual environment when done +deactivate \ No newline at end of file diff --git a/app/static/index.html b/app/static/index.html index f152b7b..a836514 100755 --- a/app/static/index.html +++ b/app/static/index.html @@ -14,6 +14,7 @@ display: flex; flex-direction: column; height: 100vh; + overflow: hidden; /* Prevent scrolling */ } .playlist-container { flex: 1; @@ -22,30 +23,32 @@ justify-content: center; align-items: center; background-color: black; + position: relative; /* Enable positioning of child elements */ } - ul { - list-style-type: none; - padding: 0; - display: none; /* Hide the playlist list */ + .playlist-container img, + .playlist-container video { + max-width: 100%; + max-height: 100%; + object-fit: contain; /* Ensure content fits within the container */ } .controls-wrapper { + position: fixed; /* Fix the controls at the bottom of the page */ + bottom: 0; /* Align to the bottom */ + left: 0; /* Align to the left */ + width: 100%; /* Full width */ display: flex; justify-content: center; - width: 33.33%; /* 1/3 of the page width */ - margin: 0 auto; + gap: 15px; /* Space between buttons */ + padding: 10px; + background-color: rgba(0, 0, 0, 0.5); /* Increased transparency */ + border-top: 2px solid #444; /* Add a border at the top */ + z-index: 100; /* Ensure buttons are above the media */ transition: opacity 0.5s ease; /* Smooth fade effect */ } .controls-wrapper.hidden { opacity: 0; /* Hide the buttons */ pointer-events: none; /* Disable interaction when hidden */ } - .controls { - display: flex; - justify-content: center; - gap: 15px; /* Space between buttons */ - padding: 10px; - background-color: #222; - } button { margin: 5px; padding: 10px; @@ -62,10 +65,6 @@ button i { pointer-events: none; } - img, video { - max-width: 100%; - max-height: 100%; - } @@ -75,22 +74,24 @@
-
- - - - - - -
+ + + + + +
\ No newline at end of file