diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..174a5cc --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "github.copilot" + ] +} \ No newline at end of file diff --git a/app.py b/app.py index 54552c3..398ee1a 100644 --- a/app.py +++ b/app.py @@ -114,8 +114,24 @@ def logout(): @admin_required def upload_content(): if request.method == 'POST': - # Handle file upload logic here - pass + target_type = request.form['target_type'] + target_id = int(request.form['target_id']) + files = request.files.getlist('files') + duration = int(request.form['duration']) + return_url = request.form['return_url'] + + for file in files: + filename = secure_filename(file.filename) + file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename) + file.save(file_path) + if target_type == 'player': + new_content = Content(file_name=filename, duration=duration, player_id=target_id) + elif target_type == 'group': + new_content = Content(file_name=filename, duration=duration, group_id=target_id) + db.session.add(new_content) + + db.session.commit() + return redirect(return_url) target_type = request.args.get('target_type') target_id = request.args.get('target_id') diff --git a/instance/dashboard.db b/instance/dashboard.db index fdd839d..bb53da3 100644 Binary files a/instance/dashboard.db and b/instance/dashboard.db differ diff --git a/static/uploads/Ibex_450.jpg b/static/uploads/Ibex_450.jpg new file mode 100644 index 0000000..5f3b4b8 Binary files /dev/null and b/static/uploads/Ibex_450.jpg differ diff --git a/static/uploads/cropped-cropped-main-picture-scaled-1.jpeg b/static/uploads/cropped-cropped-main-picture-scaled-1.jpeg new file mode 100644 index 0000000..8a15a16 Binary files /dev/null and b/static/uploads/cropped-cropped-main-picture-scaled-1.jpeg differ diff --git a/templates/player_page.html b/templates/player_page.html index 496ae9b..47efaf2 100644 --- a/templates/player_page.html +++ b/templates/player_page.html @@ -17,12 +17,12 @@ } - +

Player Schedule for {{ player.username }}

-
+

Player Info

@@ -45,7 +45,7 @@

Member of Group(s):

    {% for group in player.groups %} -
  • {{ group.name }}
  • +
  • {{ group.name }}
  • {% endfor %}
{% else %} @@ -53,15 +53,41 @@ {% endif %}
- + {% if current_user.role == 'admin' %} -
- Upload Content +
+
+

Manage Media

+
+
+ {% if content %} +
    + {% for media in content %} +
  • +

    Media Name: {{ media.file_name }}

    +

    Duration: {{ media.duration }} minutes

    +
    +
    + + +
    +
    +
    + +
    +
  • + {% endfor %} +
+ {% else %} +

No media uploaded for this player.

+ {% endif %} +
{% endif %} Back to Dashboard Full Screen + Upload Media
diff --git a/templates/upload_content.html b/templates/upload_content.html index a7d1aca..93bcac4 100644 --- a/templates/upload_content.html +++ b/templates/upload_content.html @@ -21,6 +21,7 @@

Upload Content

+