chanjunkai 5 年之前
父節點
當前提交
360379de7e
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      controller/index.py

+ 9 - 3
controller/index.py

@@ -201,8 +201,8 @@ class oa2RtspStartView(TemplateView):
         if redis_data and st == 0:
             print('select by redis data')
             # time.sleep(3)
-            res_json = eval(redis_data)
-            return JsonResponse(res_json, safe=False)
+            # res_json = eval(redis_data)
+            # return JsonResponse(res_json, safe=False)
         if access_token == '6ovF9wiXm7su9YXO67PSOkrEPb2LIOf1':
             print('pass yes')
             user_qs = UserModel.objects.filter(userID='154483823297313800138000')
@@ -236,7 +236,8 @@ class oa2RtspStartView(TemplateView):
                 else:
                     return JsonResponse({'msg': 'stop no', 'code': 0})
             # threading.Thread(target=runSendRtspMsg_thread, args=(UID, PWD, MSG)).start()
-            send_flag = self.runSendRtspMsg(UID, PWD, MSG)
+            send_flag = self.runReqRtspMsg(UID, PWD, MSG)
+            # send_flag = self.runSendRtspMsg(UID, PWD, MSG)
             rtsp_uri = '{RTSP_PREFIX}://{RESP_SERVER_DOMAIN}:443/{stream_name}'. \
                 format(RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN,
                        stream_name=stream_name,
@@ -264,6 +265,11 @@ class oa2RtspStartView(TemplateView):
         else:
             return JsonResponse({'msg': 'wrong'})
 
+    def runReqRtspMsg(self, UID, PWD, MSG):
+        request_url = 'http://localhost:5000/?UID={UID}&MSG={MSG}&CMD=1&PWD={PWD}'.\
+            format(UID=UID,PWD=PWD,MSG=MSG)
+        res = requests.get(url=request_url)
+        return
     def runSendRtspMsg(self, UID, PWD, MSG):
         # return True
         command = "./pushtool {UID} {PWD} {MSG} 1".format(UID=UID, PWD=PWD, MSG=MSG)