diff --git a/blueprints/configure_stream/configure_stream.html b/blueprints/configure_stream/configure_stream.html
new file mode 100644
index 0000000..6dee3b6
--- /dev/null
+++ b/blueprints/configure_stream/configure_stream.html
@@ -0,0 +1,34 @@
+
+
+
+
diff --git a/blueprints/upload_photo/upload_photo.py b/blueprints/upload_photo/upload_photo.py
index 20b6557..7972e7e 100644
--- a/blueprints/upload_photo/upload_photo.py
+++ b/blueprints/upload_photo/upload_photo.py
@@ -1,4 +1,5 @@
from flask import Blueprint, request, render_template, jsonify, current_app
+from utilities.tools import get_db
from werkzeug.utils import secure_filename
import os
@@ -35,6 +36,13 @@ def upload():
filename = secure_filename(file.filename)
file.save(os.path.join(folder_path, filename))
+
+ get_db().insert(
+ "media",
+ ["media_name", "media_uri"],
+ [request.form["name"], os.path.join(folder_path, filename)]
+ )
+
return jsonify({
'status': 'SUCCESS'
}), 200
\ No newline at end of file
diff --git a/blueprints/upload_slideshow/upload_slideshow.html b/blueprints/upload_slideshow/upload_slideshow.html
new file mode 100644
index 0000000..ad913d6
--- /dev/null
+++ b/blueprints/upload_slideshow/upload_slideshow.html
@@ -0,0 +1,46 @@
+
+
+
+
Video Commander
+
+
+
+
+
+
+
+
+
+
Upload a Slideshow of Photos
+
+
+ Upload a slideshow of photos, you'll be able to order the photos on the next screen
+
+
+
+
+
\ No newline at end of file
diff --git a/blueprints/upload_slideshow/upload_slideshow.py b/blueprints/upload_slideshow/upload_slideshow.py
new file mode 100644
index 0000000..c334c2c
--- /dev/null
+++ b/blueprints/upload_slideshow/upload_slideshow.py
@@ -0,0 +1,48 @@
+from flask import Blueprint, request, render_template, jsonify, current_app
+from utilities.tools import get_db
+from werkzeug.utils import secure_filename
+import os
+
+upload_photo_bp = Blueprint('upload_slideshow', __name__, url_prefix='/upload', template_folder='.')
+
+@upload_photo_bp.route('/slideshow', methods=['GET', 'POST'])
+def get_page():
+ if request.method == "GET":
+ return render_get(), 200
+ elif request.method == "POST":
+ return upload()
+
+def render_get():
+ return render_template('upload_slideshow.html')
+
+def upload():
+ if not request.files['files[]']:
+ return jsonify({
+ 'status': 'FAILED',
+ 'error': '/upload/slideshow requires 1 or more photos'
+ }), 400
+
+ # TODO Button name data exists
+ # TODO Button name already exists validation
+ # TODO File input validation
+ print(request.files['files[]'])
+
+ file = request.files['files[]']
+
+ if file:
+ folder_path = os.path.join(current_app.config["config"]["upload_location"], request.form["name"])
+ if not os.path.exists(folder_path):
+ os.makedirs(folder_path)
+
+ filename = secure_filename(file.filename)
+ file.save(os.path.join(folder_path, filename))
+
+ get_db().insert(
+ "media",
+ ["media_name", "media_uri"],
+ [request.form["name"], os.path.join(folder_path, filename)]
+ )
+
+ return jsonify({
+ 'status': 'SUCCESS'
+ }), 200
\ No newline at end of file
diff --git a/sc_database_generator.py b/sc_database_generator.py
index c5c2486..f169f79 100644
--- a/sc_database_generator.py
+++ b/sc_database_generator.py
@@ -41,8 +41,9 @@ my_db.query("""
my_db.query("""
CREATE TABLE IF NOT EXISTS media_playback_option (
media_playback_option_id INTEGER PRIMARY KEY AUTOINCREMENT,
+ media_id INTEGER NOT NULL,
media_playback_option TEXT NOT NULL,
- media_playback_option_weight NOT NULL CHECK(media_playback_option_weight >= 1)
+ media_playback_option_weight INTEGER NOT NULL CHECK(media_playback_option_weight >= 1)
)
""")
diff --git a/sc_webserver.py b/sc_webserver.py
index 9c23fee..5d7e6c2 100644
--- a/sc_webserver.py
+++ b/sc_webserver.py
@@ -1,6 +1,7 @@
from flask import Flask
from blueprints.home.home import home_bp
from blueprints.upload_photo.upload_photo import upload_photo_bp
+from blueprints.configure_stream.configure_stream import configure_stream_bp
import os
import json
@@ -11,9 +12,11 @@ if not os.path.exists(config_json["upload_location"]):
os.makedirs(config_json["upload_location"])
app = Flask(__name__)
+app.config["MAX_CONTENT_LENGTH"] = 3 * (1024 ** 3)
app.config["config"] = config_json
app.register_blueprint(home_bp)
app.register_blueprint(upload_photo_bp)
+app.register_blueprint(configure_stream_bp)
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=2025)
\ No newline at end of file
diff --git a/scdb.db b/scdb.db
index 2f3b37e..1bf26f1 100644
Binary files a/scdb.db and b/scdb.db differ