player fullscreen

This commit is contained in:
Ske087
2025-02-01 21:40:46 +02:00
parent 85a23eeca8
commit 482fe55137
10 changed files with 29 additions and 42 deletions

Binary file not shown.

14
app.py
View File

@@ -481,8 +481,11 @@ def upload_personalization_pictures():
def clean_unused_files(): def clean_unused_files():
# Get all file names from the database # Get all file names from the database
content_files = {content.file_name for content in Content.query.all()} content_files = {content.file_name for content in Content.query.all()}
logo_file = 'logo.png' logo_file = 'resurse/logo.png'
login_picture_file = 'login_picture.png' login_picture_file = 'resurse/login_picture.png'
# Debugging: Print the content files from the database
print("Content files from database:", content_files)
# Get all files in the upload folder # Get all files in the upload folder
all_files = set(os.listdir(app.config['UPLOAD_FOLDER'])) all_files = set(os.listdir(app.config['UPLOAD_FOLDER']))
@@ -491,15 +494,22 @@ def clean_unused_files():
used_files = content_files | {logo_file, login_picture_file} used_files = content_files | {logo_file, login_picture_file}
unused_files = all_files - used_files unused_files = all_files - used_files
# Debugging: Print the lists of files
print("All files:", all_files)
print("Used files:", used_files)
print("Unused files:", unused_files)
# Delete unused files # Delete unused files
for file_name in unused_files: for file_name in unused_files:
file_path = os.path.join(app.config['UPLOAD_FOLDER'], file_name) file_path = os.path.join(app.config['UPLOAD_FOLDER'], file_name)
if os.path.isfile(file_path): if os.path.isfile(file_path):
print(f"Deleting file: {file_path}") # Debugging: Print the file being deleted
os.remove(file_path) os.remove(file_path)
flash('Unused files have been cleaned.', 'success') flash('Unused files have been cleaned.', 'success')
return redirect(url_for('admin')) return redirect(url_for('admin'))
@app.context_processor @app.context_processor
def inject_theme(): def inject_theme():
if current_user.is_authenticated: if current_user.is_authenticated:

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

BIN
static/uploads/Ibex_450.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

View File

@@ -24,7 +24,7 @@
<div class="container py-5"> <div class="container py-5">
<div class="d-flex justify-content-start align-items-center mb-4"> <div class="d-flex justify-content-start align-items-center mb-4">
{% if logo_exists %} {% if logo_exists %}
<img src="{{ url_for('static', filename='uploads/logo.png') }}" alt="Logo" class="logo"> <img src="{{ url_for('static', filename='resurse/logo.png') }}" alt="Logo" class="logo">
{% endif %} {% endif %}
<h1 class="mb-0">Dashboard</h1> <h1 class="mb-0">Dashboard</h1>
</div> </div>

View File

@@ -54,25 +54,6 @@
</div> </div>
</div> </div>
<!-- Add Player Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header">
<h2>Add Player</h2>
</div>
<div class="card-body">
<form action="{{ url_for('add_player') }}" method="post">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control {{ 'dark-mode' if theme == 'dark' else '' }}" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control {{ 'dark-mode' if theme == 'dark' else '' }}" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Add Player</button>
</form>
</div>
</div>
<!-- Groups Section --> <!-- Groups Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}"> <div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">

View File

@@ -16,7 +16,7 @@
<div class="row"> <div class="row">
<div class="col-md-6 text-center"> <div class="col-md-6 text-center">
{% if login_picture_exists %} {% if login_picture_exists %}
<img src="{{ url_for('static', filename='uploads/login_picture.png') }}" alt="Login Picture" class="login-picture"> <img src="{{ url_for('static', filename='resurse/login_picture.png') }}" alt="Login Picture" class="login-picture">
{% endif %} {% endif %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">

View File

@@ -25,7 +25,7 @@
<div class="container py-5"> <div class="container py-5">
<div class="d-flex justify-content-start align-items-center mb-4"> <div class="d-flex justify-content-start align-items-center mb-4">
{% if logo_exists %} {% if logo_exists %}
<img src="{{ url_for('static', filename='uploads/logo.png') }}" alt="Logo" class="logo"> <img src="{{ url_for('static', filename='resurse/logo.png') }}" alt="Logo" class="logo">
{% endif %} {% endif %}
<h1 class="mb-0">Manage Group: {{ group.name }}</h1> <h1 class="mb-0">Manage Group: {{ group.name }}</h1>
</div> </div>

View File

@@ -1,24 +1,21 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Player Fullscreen Schedule</title> <title>Player Fullscreen</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style> <style>
body, html { body {
height: 100%;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: black; background-color: black;
margin: 0;
overflow: hidden;
} }
img, video, embed, object { .content-item {
max-width: 100%;
max-height: 100%;
width: 100%;
height: 100%;
display: none; display: none;
width: 100vw;
height: 100vh;
object-fit: cover;
} }
.active { .content-item.active {
display: block; display: block;
} }
</style> </style>
@@ -32,14 +29,13 @@
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
{% elif item.file_name.endswith('.pdf') %} {% elif item.file_name.endswith('.pdf') %}
<object data="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" type="application/pdf" class="content-item" data-duration="{{ item.duration }}"> <object data="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" type="application/pdf" class="content-item" data-duration="{{ item.duration }}"></object>
<embed src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" type="application/pdf" class="content-item" data-duration="{{ item.duration }}">
</object>
{% else %} {% else %}
<img src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" alt="Content Image" class="content-item" data-duration="{{ item.duration }}"> <img src="{{ url_for('static', filename='uploads/' ~ item.file_name) }}" class="content-item" data-duration="{{ item.duration }}" alt="{{ item.file_name }}">
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const items = document.querySelectorAll('.content-item'); const items = document.querySelectorAll('.content-item');