feat: init impl video watch

This commit is contained in:
swve 2022-11-29 23:55:46 +01:00
parent c425b55c93
commit 0997ea4135
3 changed files with 36 additions and 22 deletions

View file

@ -17,12 +17,12 @@ async def upload_thumbnail(thumbnail_file, name_in_disk):
async def upload_video(video_file, name_in_disk, element_id):
contents = video_file.file.read()
video_format = video_file.filename.split(".")[-1]
# create folder
os.mkdir(f"content/uploads/video/{element_id}")
try:
with open(f"content/uploads/video/{element_id}/{name_in_disk}", 'wb') as f:
with open(f"content/uploads/video/{element_id}/video.{video_format}", 'wb') as f:
f.write(contents)
f.close()