chore: use lectures naming

This commit is contained in:
swve 2023-01-15 18:34:47 +01:00
parent d7f1e6f94a
commit 7237a4de49
36 changed files with 404 additions and 403 deletions

View file

@ -0,0 +1,19 @@
import os
async def upload_video(video_file, lecture_id):
contents = video_file.file.read()
video_format = video_file.filename.split(".")[-1]
# create folder
os.mkdir(f"content/uploads/video/{lecture_id}")
try:
with open(f"content/uploads/video/{lecture_id}/video.{video_format}", 'wb') as f:
f.write(contents)
f.close()
except Exception as e:
print(e)
return {"message": "There was an error uploading the file"}
finally:
video_file.file.close()