Hi i like to do delet recorded videos by a json command
Blue Iris send told me with {delclip:@record#} it should work.
The number i record# i get back from a get request when i stop recording a video.
What i need more is that i probably have to give a authentification with as well.
I'm stuck with the command lin
Do you know how the code for python should be?
Am I on the right way with this one?:
URL = 'http://IP-Adress/admin?user=username&pw=password'
data = {'delclip':'@429152'}
r = requests.get(URL, headers={'Content-Type': 'application/json' }, json=data)
a = r.json()
print('\nResponse: \n')
print(a)
with that one i get an error back.. see picture..
Tanks for help
Delet a video by json
Delet a video by json
- Attachments
-
- Screenshot (30).png (47.26 KiB) Viewed 8685 times
Last edited by ben on Sat May 16, 2020 2:38 pm, edited 1 time in total.
- Thixotropic
- Posts: 747
- Joined: Wed Sep 04, 2019 7:20 pm
- Location: Low-Earth Orbit
Re: Delet a video by json
I don't see a picture (??)
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
Re: Delet a video by json
Since there is no broken link or URL, I wonder if that was a language thing, i.e. did he mean "Do you get the picture ?".
Forum Moderator.
Problem ? Ask and we will try to assist, but please check the Help file.
Problem ? Ask and we will try to assist, but please check the Help file.
Re: Delet a video by json
So now there is the picture ;D
Re: Delet a video by json
So i got this:
URL = "http://user:Password@192.168.1.9:81/json"
r = requests.post(URL, data=json.dumps({"delclip":"@344249"}))
print(r.text)
print(r)
and the answer is this:
{"result":"fail"}
<Response [200]>
Do know what i have to change or add, so i can delet the video?
URL = "http://user:Password@192.168.1.9:81/json"
r = requests.post(URL, data=json.dumps({"delclip":"@344249"}))
print(r.text)
print(r)
and the answer is this:
{"result":"fail"}
<Response [200]>
Do know what i have to change or add, so i can delet the video?
Re: Delet a video by json
i figure it out hope i can help some one else with that.
import json
import hashlib
from urllib.request import Request, urlopen
def Send(request):
jsonRequest = json.dumps(request).encode('ascii')
request = Request(url, jsonRequest)
response = urlopen(request).read().decode()
jsonResponse = json.loads(response)
return jsonResponse
request = { "cmd": "login" }
response = Send(request)
#print(time.monotonic())
#print(response)
session = response["session"]
s = "yourUsername:" + session + ":youPassword"
hash = hashlib.md5(s.encode("utf-8")).hexdigest()
response = Send({ "cmd": "login", "session": session, "response": hash })
print(response)
request = { "cmd": "cliplist", "session": session, "camera":"Cam1"}
#request = { "cmd": "delclip", "session": session, "path":"@441991"}
response = Send(request)
print(response)
request = { "cmd": "logout", "session": session}
response = Send(request)
response
import json
import hashlib
from urllib.request import Request, urlopen
def Send(request):
jsonRequest = json.dumps(request).encode('ascii')
request = Request(url, jsonRequest)
response = urlopen(request).read().decode()
jsonResponse = json.loads(response)
return jsonResponse
request = { "cmd": "login" }
response = Send(request)
#print(time.monotonic())
#print(response)
session = response["session"]
s = "yourUsername:" + session + ":youPassword"
hash = hashlib.md5(s.encode("utf-8")).hexdigest()
response = Send({ "cmd": "login", "session": session, "response": hash })
print(response)
request = { "cmd": "cliplist", "session": session, "camera":"Cam1"}
#request = { "cmd": "delclip", "session": session, "path":"@441991"}
response = Send(request)
print(response)
request = { "cmd": "logout", "session": session}
response = Send(request)
response
- Thixotropic
- Posts: 747
- Joined: Wed Sep 04, 2019 7:20 pm
- Location: Low-Earth Orbit
Re: Delet a video by json
Awesome, thank you for posting the solution.
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS