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 @@ } -
+Media Name: {{ media.file_name }}
+Duration: {{ media.duration }} minutes
+ + +No media uploaded for this player.
+ {% endif %} +