Video uploaded titel is now in the database
This commit is contained in:
parent
5a0a8b257e
commit
eb5169af0f
@ -305,6 +305,8 @@ def sendpage():
|
|||||||
update_session()
|
update_session()
|
||||||
return redirect("/form")
|
return redirect("/form")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# now to if it has a database field
|
# now to if it has a database field
|
||||||
|
|
||||||
# find out which table we need to write to
|
# find out which table we need to write to
|
||||||
@ -318,6 +320,22 @@ def sendpage():
|
|||||||
|
|
||||||
new_entry = db_tables[table_name](id=new_id,user_id = session_user_id,date_created = date,stimulus_name=stimulus_name)
|
new_entry = db_tables[table_name](id=new_id,user_id = session_user_id,date_created = date,stimulus_name=stimulus_name)
|
||||||
|
|
||||||
|
# handle possible Video that was send
|
||||||
|
if 'recordedVideo' in request.files:
|
||||||
|
video = request.files['recordedVideo']
|
||||||
|
formatted_date = date.strftime("%Y.%m.%d %H-%M-%S")
|
||||||
|
print("date: ", date)
|
||||||
|
video_name = str(session_user_id) + "_" + session["current_block_name"] + "_" + session["current_stimulus_name"] + "_" + str(formatted_date) + ".webm"
|
||||||
|
path = os.path.join(UPLOAD_FOLDER, video_name)
|
||||||
|
print("path: ",path)
|
||||||
|
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
||||||
|
video.save(path)
|
||||||
|
|
||||||
|
if 'recordedVideo' in request.files:
|
||||||
|
if hasattr(new_entry, "video_upload"):
|
||||||
|
setattr(new_entry, "video_upload", video_name)
|
||||||
|
|
||||||
|
|
||||||
for key, value in request.form.items():
|
for key, value in request.form.items():
|
||||||
print("hasattr key: ", key)
|
print("hasattr key: ", key)
|
||||||
if hasattr(new_entry, key):
|
if hasattr(new_entry, key):
|
||||||
|
@ -255,6 +255,11 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"size": "250",
|
"size": "250",
|
||||||
"nullable": "true"
|
"nullable": "true"
|
||||||
|
},
|
||||||
|
"video_upload":{
|
||||||
|
"type": "string",
|
||||||
|
"size": "100",
|
||||||
|
"nullable": "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user