新增hls root path参数
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
|
||||
import yaml
|
||||
from utils.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
ALERT_PUSH_URL = ""
|
||||
HLS_ROOT_PATH = ""
|
||||
|
||||
|
||||
def init_config(config_path: str = "config.yaml"):
|
||||
@@ -20,6 +22,7 @@ def init_config(config_path: str = "config.yaml"):
|
||||
cfg = yaml.safe_load(f)
|
||||
|
||||
ALERT_PUSH_URL = cfg.get("alert_push_url", "")
|
||||
HLS_ROOT_PATH = cfg.get("hls_root_path", "")
|
||||
logger.info(f"[INFO] Config initialized from {config_path}, alert_push_url={ALERT_PUSH_URL}")
|
||||
|
||||
except Exception as e:
|
||||
|
||||
@@ -34,13 +34,14 @@ database:
|
||||
# debug_mode: True=前台运行(适合PyCharm调试),False=后台运行(适合生产部署)
|
||||
debug_mode: true
|
||||
alert_push_url: "http://123.57.151.210:10000/picenter/websocket/test/process"
|
||||
hls_root_path: "D:/ProjectDoc/Police/data/hls"
|
||||
|
||||
service_groups:
|
||||
- name: "kadian_group" # 服务组名称
|
||||
video_source_type: "hls"
|
||||
ws_host: "0.0.0.0" # WebSocket 服务地址
|
||||
ws_port: 8765 # WebSocket 服务端口
|
||||
algorithm: "kadian" # 算法类型
|
||||
algorithm: "supervision_room" # 算法类型
|
||||
cameras: # 该组下的摄像头列表
|
||||
- id: 1
|
||||
index: testindexcode
|
||||
|
||||
55
test_cam.py
55
test_cam.py
@@ -13,30 +13,41 @@ signer = HikvisionOpenAPISigner(
|
||||
headers={'tagId': '0'} # 根据平台要求设置
|
||||
)
|
||||
|
||||
def get_camera_preview_url(camera_index_code):
|
||||
# 签名一个请求
|
||||
request = signer.sign(
|
||||
'POST',
|
||||
'/api/video/v1/cameras/previewURLs',
|
||||
jsons={'cameraIndexCode': camera_index_code, 'protocol': 'rtsp', 'expand': 'streamform=rtp'},
|
||||
accept='application/json'
|
||||
)
|
||||
method, url, headers, body = request
|
||||
# 发送请求
|
||||
response = requests.request(method, url, headers=headers, data=body, verify=False)
|
||||
return response.json()
|
||||
|
||||
# # for test
|
||||
# def get_camera_preview_url(camera_index_code):
|
||||
# """测试用的方法,直接返回固定结果"""
|
||||
# return {
|
||||
# "code": "0",
|
||||
# "msg": "SUCCESS",
|
||||
# "data": {
|
||||
# "url": "rtsp://localhost:8554/test"
|
||||
# }
|
||||
# }
|
||||
# # 签名一个请求
|
||||
# request = signer.sign(
|
||||
# 'POST',
|
||||
# '/api/video/v1/cameras/previewURLs',
|
||||
# jsons={'cameraIndexCode': camera_index_code, 'protocol': 'rtsp', 'expand': 'streamform=rtp'},
|
||||
# accept='application/json'
|
||||
# )
|
||||
# method, url, headers, body = request
|
||||
# # 发送请求
|
||||
# response = requests.request(method, url, headers=headers, data=body, verify=False)
|
||||
# return response.json()
|
||||
|
||||
# for test
|
||||
def get_camera_preview_url(camera_index_code):
|
||||
"""测试用的方法,直接返回固定结果"""
|
||||
return {
|
||||
"code": "0",
|
||||
"msg": "SUCCESS",
|
||||
"data": {
|
||||
# "url": "rtsp://192.168.110.139:8554/test"
|
||||
"url": "rtsp://192.168.43.33:8554/test"
|
||||
# "url": "rtsp://localhost:8554/test"
|
||||
}
|
||||
}
|
||||
|
||||
def get_camera_hls_url(camera_index_code):
|
||||
"""测试用的方法,直接返回固定结果"""
|
||||
return {
|
||||
"code": "0",
|
||||
"msg": "SUCCESS",
|
||||
"data": {
|
||||
"url": "https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8"
|
||||
}
|
||||
}
|
||||
|
||||
# # 读取 config.yaml
|
||||
# with open('config.yaml', 'r', encoding='utf-8') as f:
|
||||
|
||||
Reference in New Issue
Block a user