-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Olá @wiltonsr
Após executar o comando para listar os arquivos todos são baixados pelo script mas ficam vazios.
Será que eles mudaram a API nas últimas versões?
DVR iMHDX 3008
Tentando download pelo navegador
A resposta é 200 mas o arquivo está indisponível
import sys
import logging
import cv2
import os
import re
import numpy as np
from pyintelbras import IntelbrasAPI
stream = logging.StreamHandler(sys.stdout)
stream.setLevel(logging.DEBUG)
log = logging.getLogger('pyintelbras')
log.addHandler(stream)
log.setLevel(logging.DEBUG)
intelbras = IntelbrasAPI("http://127.0.0.1:80/")
intelbras.login("admin", "admin")
params = {
'condition.Channel': 3,
'condition.StartTime': '2025-5-12 23:00:00',
'condition.EndTime': '2025-5-13 13:00:00'
}
r = intelbras.find_media_files(params)
# --- extract each .dav path and download ---
for i, item in enumerate(r.get('items')):
path = item.get('FilePath')
print(f'Downloading {path}')
resp = intelbras.RPC_Loadfile(extra_path=path)
if resp.status_code == 200:
name = os.path.join('tmp', os.path.basename(path).strip())
with open(name, 'wb') as f:
f.write(resp.content)
print(f"Downloaded tmp/{name}")
else:
print(f"Failed to download {path}: {resp.status_code}")
items[0].Channel=2
items[0].Cluster=283512
items[0].CutLength=7602176
items[0].Disk=0
items[0].EndTime=2025-05-12 02:13:50
items[0].Events[0]=VideoMotion
items[0].FilePath=/mnt/dvr/2025-05-12/002/dav/02/0/0/283512/02.13.36-02.13.50[M][0@0][0].dav
items[0].Flags[0]=Event
items[0].Length=7602176
items[0].Partition=0
items[0].StartTime=2025-05-12 02:13:36
items[0].Type=dav
items[0].VideoStream=Main
items[1].Channel=2
items[1].Cluster=284337
items[1].CutLength=7536640
items[1].Disk=0
items[1].EndTime=2025-05-12 03:22:32
items[1].Events[0]=VideoMotion
items[1].FilePath=/mnt/dvr/2025-05-12/002/dav/03/0/0/284337/03.22.18-03.22.32[M][0@0][0].dav
items[1].Flags[0]=Event
items[1].Length=7536640
items[1].Partition=0
items[1].StartTime=2025-05-12 03:22:18
items[1].Type=dav
items[1].VideoStream=Main
....
(.venv) PS D:\vision\intelbras> python .\intelbras_download.py
API Server Endpoint: http://127.0.0.1:80
Call method 'mediaFileFind' with arguments: () and {'action': 'factory.create'}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/mediaFileFind.cgi?action=factory.create
Request status_code 200 - OK
Call method 'mediaFileFind' with arguments: () and {'action': 'findFile', 'condition.Channel': 3, 'condition.StartTime': '2025-5-12 23:00:00', 'condition.EndTime': '2025-5-13 13:00:00', 'object': 1116102408}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/mediaFileFind.cgi?action=findFile&condition.Channel=3&condition.StartTime=2025-5-12+23%3A00%3A00&condition.EndTime=2025-5-13+13%3A00%3A00&object=1116102408
Request status_code 200 - OK
Call method 'mediaFileFind' with arguments: () and {'action': 'findNextFile', 'object': 1116102408, 'count': 100}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/mediaFileFind.cgi?action=findNextFile&object=1116102408&count=100
Request status_code 200 - OK
Found 100 media files.
Call method 'mediaFileFind' with arguments: () and {'action': 'close', 'object': 1116102408}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/mediaFileFind.cgi?action=close&object=1116102408
Request status_code 200 - OK
Call method 'mediaFileFind' with arguments: () and {'action': 'destroy', 'object': 1116102408}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/mediaFileFind.cgi?action=destroy&object=1116102408
Request status_code 200 - OK
Downloading /mnt/dvr/2025-05-12/002/dav/02/0/0/283512/02.13.36-02.13.50[M][0@0][0].dav
Call method 'RPC_Loadfile' with arguments: () and {}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/RPC_Loadfile/mnt/dvr/2025-05-12/002/dav/02/0/0/283512/02.13.36-02.13.50[M][0@0][0].dav.cgi
Request status_code 200 - OK
Downloaded tmp/tmp\02.13.36-02.13.50[M][0@0][0].dav
Downloading /mnt/dvr/2025-05-12/002/dav/03/0/0/284337/03.22.18-03.22.32[M][0@0][0].dav
Call method 'RPC_Loadfile' with arguments: () and {}
Requesting GET to URL http://127.0.0.1:80/cgi-bin/RPC_Loadfile/mnt/dvr/2025-05-12/002/dav/03/0/0/284337/03.22.18-03.22.32[M][0@0][0].dav.cgi
Request status_code 200 - OK
Downloaded tmp/tmp\03.22.18-03.22.32[M][0@0][0].dav
.......
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

