From 9790d8be36887e49bbc55724daa6911d1a772b46 Mon Sep 17 00:00:00 2001 From: Scheianu Ionut Date: Sun, 11 May 2025 19:18:28 +0300 Subject: [PATCH] almost final app --- app/__pycache__/app.cpython-312.pyc | Bin 12058 -> 13046 bytes app/app.py | 22 ++++++ app/run_app.sh | 21 ++++++ app/static/index.html | 112 ++++++++++++++++++++-------- 4 files changed, 122 insertions(+), 33 deletions(-) mode change 100755 => 100644 app/__pycache__/app.cpython-312.pyc create mode 100644 app/run_app.sh diff --git a/app/__pycache__/app.cpython-312.pyc b/app/__pycache__/app.cpython-312.pyc old mode 100755 new mode 100644 index e22e1ee6244267f9516606c21519029bcac84f6e..d4b45bdf1163c667c88c7c2b5edc8e737b06b650 GIT binary patch delta 1489 zcmZ8gZ%kWN6uyQ@15T{ zzjJ!;x#wL!_or;zuv&QptNxZa5Gz}&l5<4Ke~#Jt95Yhgqz@1dxd2!JKT3g{y?KtHhqmJ$bGK+aFJ)BJ)$x`7S(gODP@SwpLj4~Y@5+9Ry)kU`~FDeTWBk=nJ;VHYNt2}TNQ z9~HLNsKGBhsIwqmb4AiD;PhcmGj*! zZq`)W^*r3A*^4v=kJE2F5Aj9qX0e3vyW02O*BLyoHTX|qyiCVRzr#0ZTVNl5sy!{v zVf-2WvaFI*;RLs|pUWi7jf45Q<_Zq8_-*Y{^=p`$1J4)QFEt-9+&q}uG#QGB{b1!5 z2bKYz-+7pwYsd^g+E5UnBSC?B9r-LqY975)+ajpeY)-hOXNdW)1db!Y}ivub=;PIJj2SsqoA;7RJ=l&BQxLHDSv#79WHzc0J9 zzD#lD3PgX>#e)DdXp6V)GA8qhooS)q>e>0To1Wt-q4|*zNeK;)gkVaj+{p%xrG&

u~5bbsp z(Ka7HJ%J=cSC7P`jcQCeFRN)IiOItw7bG@qRtFS0MxeWCV^7A+92~j@QdPo`lJP#- zvXV^ffBot^&?(EXk>B7+mIBP69c$5jkJW$I>Q7a+eBG0>K0kA2i{c`s>W@6u{alU!obOYf3r!OI|62L~0&;-b_JH`Jol^uwo(8{DzK~NDufLHD5(f>Vsm`NPXEAAMUHF@Gb*u(YRv2?G1@4K z>0CDI4tYZjE5IrD2#>l+9&?ZKJ~xFm(Z-2`F9e>K;{Cn&zgeL0Lw6N7%?D63Ttm%r z9o66o)Epl~&3lQ)8F3#NErhfN4lRcC6=@_SQ+22r(j-zTql{3RrWpXz4HH6yv!>-wtv-}I;XPZ@@-@jv|*=y zbJla3GhTK4lvt$&FywoB4#1R$V_yKu@^{}Pz)3j~zeM1)T+x?fa8aI3NfmC1pXnW# zm)jWzu<+8jrb0_z&z}bn;>EFd@L2eTAMjM(D7FBY_%>qECT_PPGbRIi8*x?EO0xt< zye>}zUBbvKnPp2VZ6kgZ&&M1w;n*-H?l|LO-B}w9`u(8O4~qS^=v2-4L&V@qG!3y{ y&C8wYHdJ@x3K?k6Z$>ho$?z6IHMU6p6N$BIi?s)tXUT=y2V(EW6q5BXWA7g!-kJyi 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