|
@@ -210,6 +210,8 @@ async def wait_finish(video_data:dict):
|
|
|
zip_filename = video_data['stored_filename']+".zip"
|
|
|
process = await asyncio.create_subprocess_exec("sshpass", "-p", "choozmo9",
|
|
|
"scp", "-P", "5722", "-o", "StrictHostKeyChecking=no", f"/tmp/{zip_filename}", f"root@172.104.93.163:{str(LOCAL_ZIP_STORAGE)}")
|
|
|
+ if os.path.exists(f"/tmp/{zip_filename}"):
|
|
|
+ os.remove(f"/tmp/{zip_filename}")
|
|
|
await process.wait()
|
|
|
|
|
|
task = celery_app.send_task("app.worker.make_video", kwargs=video_data)
|
|
@@ -264,6 +266,7 @@ async def wait_finish(video_data:dict):
|
|
|
state: success'
|
|
|
}
|
|
|
data = requests.post(LINE_URL, headers=headers, data=data)
|
|
|
+ send_simple_email(email_to=video_data['email'], video_path=f"http://172.104.93.163:30080/{video_data['stored_filename']}.mp4")
|
|
|
|
|
|
elif task.state == "FAILURE":
|
|
|
db = SessionLocal()
|
|
@@ -285,7 +288,7 @@ async def wait_finish(video_data:dict):
|
|
|
state: failure'
|
|
|
}
|
|
|
data = requests.post(LINE_URL, headers=headers, data=data)
|
|
|
- send_simple_email(email_to=video_data['email'], video_path=f"http://172.104.93.163:30080/{video_data['stored_filename']}.mp4")
|
|
|
+ send_simple_email(email_to=video_data['email'], video_path=None)
|
|
|
|
|
|
def send_simple_email(email_to: str, video_path: str):
|
|
|
if video_path==None:
|
|
@@ -311,3 +314,4 @@ def send_simple_email(email_to: str, video_path: str):
|
|
|
'password':'hlmaxzjnvpeaulhw',
|
|
|
'timeout': 30})
|
|
|
assert r.status_code == 250
|
|
|
+
|