chanjunkai hace 5 años
padre
commit
5f054b8445
Se han modificado 1 ficheros con 10 adiciones y 7 borrados
  1. 10 7
      controller/index.py

+ 10 - 7
controller/index.py

@@ -29,7 +29,8 @@ from azoauth.config import *
 SERVER_PREFIX = 'http://www.dvema.com'
 # PORT_PREFIX = '8554'
 PORT_PREFIX = '443'
-
+RTSP_PREFIX = 'rtsps'
+# RTSP_PREFIX = 'rtsp'
 
 class authView(TemplateView):
     def post(self, request, *args, **kwargs):
@@ -213,8 +214,8 @@ class oa2RtspStartView(TemplateView):
             # ur_qs = UidRtspModel.objects.filter(usermodel__userID=userID,uid=)
             UID = ur_qs[0]['uid']
             PWD = ur_qs[0]['password']
-            MSG = 'rtsp://{RESP_SERVER_DOMAIN}:{PORT_PREFIX}/{stream_name}'. \
-                format(RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN, stream_name=ur_qs[0]['rtsp_url'],PORT_PREFIX=PORT_PREFIX)
+            MSG = '{RTSP_PREFIX}://{RESP_SERVER_DOMAIN}:{PORT_PREFIX}/{stream_name}'. \
+                format(RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN, stream_name=ur_qs[0]['rtsp_url'],PORT_PREFIX=PORT_PREFIX,RTSP_PREFIX=RTSP_PREFIX)
             # po = Pool(10)
             # po.apply_async(self.runSendRtspMsg, (UID, PWD, MSG))
             print(UID)
@@ -228,6 +229,8 @@ class oa2RtspStartView(TemplateView):
                     return JsonResponse({'msg': 'stop no', 'code': 0})
             # threading.Thread(target=runSendRtspMsg_thread, args=(UID, PWD, MSG)).start()
             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=ur_qs[0]['rtsp_url'],RTSP_PREFIX=RTSP_PREFIX)
             res_json = {
                 'endpointId': id,
                 'manufacturerName': 'Axis',
@@ -241,8 +244,7 @@ class oa2RtspStartView(TemplateView):
                 'audioCodecs': ['G711'],
                 'protocols': ['RTSP'],
                 'authorizationTypes': ['NONE'],
-                'uri': 'rtsp://{RESP_SERVER_DOMAIN}:443/{stream_name}'.format(RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN,
-                                                                              stream_name=ur_qs[0]['rtsp_url'])
+                'uri':rtsp_uri
             }
             if send_flag:
                 redisObj.set_data(key=key, val=str(res_json), expire=30)
@@ -325,6 +327,8 @@ class oa2DiscoveryDevice(TemplateView):
                             rtsp_url=rtsp_url,
                         )
                     uid_rtsp_id_list.append(uid_rtsp_qs.id)
+                    rtsp_uri = '{RTSP_PREFIX}://{RESP_SERVER_DOMAIN}:443/{stream_name}'.\
+                        format(RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN, stream_name=rtsp_url,RTSP_PREFIX=RTSP_PREFIX)
                     ur_data = {
                         'endpointId': uid_a['uid'],
                         'manufacturerName': 'Axis',
@@ -337,8 +341,7 @@ class oa2DiscoveryDevice(TemplateView):
                         'audioCodecs': ['ACC'],
                         'protocols': ['RTSP'],
                         'authorizationTypes': ['NONE'],
-                        'uri': 'rtsp://{RESP_SERVER_DOMAIN}:443/{stream_name}'.format(
-                            RESP_SERVER_DOMAIN=RESP_SERVER_DOMAIN, stream_name=rtsp_url)
+                        'uri': rtsp_uri
                     }
                     res_json.append(ur_data)
                 print(uid_rtsp_id_list)