фикс камеры 4

This commit is contained in:
dv 2026-04-14 15:41:19 +03:00
parent f788067d5a
commit 750708a80e

View file

@ -136,9 +136,8 @@ async def isapi_snapshot(
if frame_url: if frame_url:
url = frame_url url = frame_url
else: else:
# Hikvision ISAPI channel format: channel 1 main = 101 # Hikvision: channel 1 main stream = 101, channel 2 = 201, etc.
ch = f"{channel:02d}1" url = f"http://{device.ip}:{port}/ISAPI/Streaming/channels/{channel}01/picture?snapShotImageType=JPEG"
url = f"http://{device.ip}:{port}/ISAPI/Streaming/channels/{ch}/picture"
log.info("[camera] snapshot GET %s (user=%r)", url, user) log.info("[camera] snapshot GET %s (user=%r)", url, user)
try: try:
@ -182,9 +181,7 @@ async def mjpeg_stream(
if stream_url.startswith("http"): if stream_url.startswith("http"):
url = stream_url url = stream_url
else: else:
# Hikvision ISAPI MJPEG: channel 1 main = 101 url = f"http://{device.ip}:{port}/ISAPI/Streaming/channels/{channel}01/httppreview"
ch = f"{channel:02d}1"
url = f"http://{device.ip}:{port}/ISAPI/Streaming/channels/{ch}/httppreview"
async with httpx.AsyncClient(auth=(user, password), timeout=httpx.Timeout(timeout)) as client: async with httpx.AsyncClient(auth=(user, password), timeout=httpx.Timeout(timeout)) as client:
async with client.stream("GET", url) as resp: async with client.stream("GET", url) as resp: