if new_ip_dec == old_ip: exit(0) if new_ip_dec == "192.168.1.10": new_ip_hex = "0x0A01A8C0" elif new_ip_dec == "192.168.1.11": new_ip_hex = "0x0B01A8C0" elif new_ip_dec == "192.168.1.12": new_ip_hex = "0x0C01A8C0" elif new_ip_dec == "192.168.1.13": new_ip_hex = "0x0D01A8C0" elif new_ip_dec == "192.168.1.14": new_ip_hex = "0x0E01A8C0" elif new_ip_dec == "192.168.1.15": new_ip_hex = "0x0F01A8C0" cam = DVRIPCam(old_ip, "admin") if cam.login(): # cam.set_info('NetWork.NetDHCP[0].Enable', "False") # cam.set_info('IPAdaptive.IPAdaptive', "False") # print(cam.get_info('IPAdaptive.IPAdaptive')) # print(cam.get_info('NetWork')) # print(cam.get_info('NetWork.NetDHCP[0].Enable')) cam.set_info('NetWork.NetCommon.HostIP', new_ip_hex) cam.close() # cam = DVRIPCam(new_ip_dec, "admin", "") # if cam.login(): # print(cam.get_info('NetWork.NetDHCP[0].Enable')) # cam.close() except: exit(1)
if cam.login(): print("Success! Connected to " + host_ip) else: print("Failure. Could not connect.") info = cam.get_info("fVideo.OSDInfo") print(json.dumps(info, ensure_ascii=False)) info["OSDInfo"][0]["Info"] = [u"Тест00", "Test01", "Test02"] # info["OSDInfo"][0]["Info"][1] = "" # info["OSDInfo"][0]["Info"][2] = "" # info["OSDInfo"][0]["Info"][3] = "Test3" info["OSDInfo"][0]["OSDInfoWidget"]["EncodeBlend"] = True info["OSDInfo"][0]["OSDInfoWidget"]["PreviewBlend"] = True # info["OSDInfo"][0]["OSDInfoWidget"]["RelativePos"] = [6144,6144,8192,8192] cam.set_info("fVideo.OSDInfo", info) # enc_info = cam.get_info("Simplify.Encode") # Alarm example def alarm(content, ids): print(content) cam.setAlarm(alarm) cam.alarmStart() # cam.get_encode_info() # sleep(1) # cam.get_camera_info() # sleep(1) # enc_info[0]['ExtraFormat']['Video']['FPS'] = 20 # cam.set_info("Simplify.Encode", enc_info)
import sys from dvrip import DVRIPCam from time import sleep host_ip = '192.168.2.108' if len(sys.argv) > 1: host_ip = str(sys.argv[1]) cam = DVRIPCam(host_ip) cam.connect() if cam.login(): print "Success! Connected to " + host_ip else: print "Failure. Could not connect." enc_info = cam.get_info(1042, "Simplify.Encode") cam.get_encode_info() sleep(1) cam.get_camera_info() sleep(1) enc_info['Simplify.Encode'][0]['ExtraFormat']['Video']['FPS'] = 20 cam.set_info(1040, "Simplify.Encode", enc_info) sleep(2) print(cam.get_info(1042, "Simplify.Encode")) cam.close()