Browse Source

mod video websocket

tomoya 2 years ago
parent
commit
20b9a5f9ac
1 changed files with 4 additions and 3 deletions
  1. 4 3
      backend/app/app/api/api_v1/endpoints/videos.py

+ 4 - 3
backend/app/app/api/api_v1/endpoints/videos.py

@@ -133,11 +133,12 @@ async def wait_finish(video_data:dict):
         video = db.query(models.Video).get(video_data['id'])
         user = db.query(models.User).get(video_data['owner_id'])
         video.progress_state = "SUCCESS" 
-        if task.result:
-            user.available_time -= int(task.result)
+        if time := task.result:
+            user.available_time -= int(time)
+            video.length = int(time)
         db.commit()
         db.close()
-        msg_data = f"{video_data['stored_filename']}:SUCCESS"
+        msg_data = f"{video_data['stored_filename']}:SUCCESS:{int(time)}"
 
     elif task.state == "FAILURE":
         db = SessionLocal()