|
@@ -68,7 +68,8 @@ def upload_plot(
|
|
|
upload_file.file.close()
|
|
|
zip_filename = video.stored_file_name+".zip"
|
|
|
print(str(BACKEND_ZIP_STORAGE/zip_filename))
|
|
|
- subprocess.run([f"sshpass -p choozmo9 scp -P 5722 -o StrictHostKeyChecking=no {str(BACKEND_ZIP_STORAGE/zip_filename)} root@172.104.93.163:{str(LOCAL_ZIP_STORAGW/zip_filename)}"])
|
|
|
+ subprocess.run(["sshpass", "-p", "choozmo9"
|
|
|
+ "scp", "-P", "5722", "-o", "StrictHostKeyChecking=no" f"{str(BACKEND_ZIP_STORAGE/zip_filename)}", f"root@172.104.93.163:{str(LOCAL_ZIP_STORAGW/zip_filename)}"])
|
|
|
celery_app.send_task("app.worker.make_video", args=[video.id, video.stored_file_name, current_user.id])
|
|
|
return video
|
|
|
|
|
@@ -80,18 +81,5 @@ def download_video(
|
|
|
current_user: models.User = Depends(deps.get_current_active_user),
|
|
|
) -> Any:
|
|
|
|
|
|
- video = db.query(models.Video).filter(db=db, id=id).first()
|
|
|
- if not video:
|
|
|
- raise HTTPException(status_code=404, detail="Video not found")
|
|
|
- if not crud.user.is_superuser(current_user) and (video.owner_id != current_user.id):
|
|
|
- raise HTTPException(status_code=400, detail="Not enough permissions")
|
|
|
- if not video.progress == "completed":
|
|
|
- raise HTTPException(status_code=400, detail="Video not completed yet")
|
|
|
-
|
|
|
- result = celery_app.send_task("app.worker.upload_to_server", args=[video.id, video.stored_file_name])
|
|
|
-
|
|
|
- if result.get() == "completed" and (file_path:=Path(VIDEO_STORAGE).joinpath(video.stored_file_name+".mp4")).exit():
|
|
|
- return FileResponse(path=str(file_path), filename=video.title+".mp4")
|
|
|
- else:
|
|
|
- raise HTTPException(status_code=404, detail="Error occurs")
|
|
|
+ pass
|
|
|
|