You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7KB

  1. from json import dumps
  2. from util.TimeUtils import now_date_to_str
  3. def message_feedback(requestId, status, analyse_type, error_code="", error_msg="", progress="", original_url="",
  4. sign_url="", modelCode="", detectTargetCode="", analyse_results="", video_url="", ai_video_url=""):
  5. if len(analyse_results) > 0:
  6. analyse_results = dumps(analyse_results)
  7. taskbar = {
  8. "request_id": requestId,
  9. "status": status,
  10. "type": analyse_type,
  11. "video_url": video_url,
  12. "ai_video_url": ai_video_url,
  13. "error_code": error_code,
  14. "error_msg": error_msg,
  15. "progress": progress,
  16. "results": [
  17. {
  18. "original_url": original_url,
  19. "sign_url": sign_url,
  20. "analyse_results": analyse_results,
  21. "model_code": modelCode,
  22. "detect_targets_code": detectTargetCode,
  23. "analyse_time": now_date_to_str()
  24. }
  25. ]
  26. }
  27. return {"feedback": taskbar}
  28. def recording_feedback(requestId, status, error_code="", error_msg="", progress="", video_url=""):
  29. rdf = {
  30. "request_id": requestId,
  31. "status": status,
  32. "error_code": error_code,
  33. "error_msg": error_msg,
  34. "progress": progress,
  35. "video_url": video_url
  36. }
  37. return {"recording": rdf}
  38. def pull_stream_feedback(requestId, status, error_code="", error_msg="", videoInfo=[]):
  39. return {"pull_stream": {
  40. "request_id": requestId,
  41. "video_info_list": videoInfo,
  42. "push_stream_status": status,
  43. "error_code": error_code,
  44. "error_msg": error_msg,
  45. "current_time": now_date_to_str()
  46. }}