I've written this little Python script to enable or disable each cameras on Sighthound by command line.
If you want to use the script you must have (obiouvsly) Python installed on your computer which Sighthound is running (but you can modify the code for enable or disable remotely).
Enable remote access on Sighthound application
Sightshell.py
- Code: Select all
import os
import sys
import pycurl
port = sys.argv[1]
userpsw = sys.argv[2]
method = sys.argv[3]
camera = sys.argv[4]
url = "https://127.0.0.1:" + port + "/xmlrpc/"
def command():
c = pycurl.Curl()
c.setopt(pycurl.URL, '%s' % url)
c.setopt(pycurl.HTTPHEADER, ["Content-type: application/xml"])
c.setopt(c.POSTFIELDS,config)
c.setopt(pycurl.VERBOSE, 0)
c.setopt(pycurl.USERPWD, userpsw)
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.SSL_VERIFYPEER, False)
c.setopt(pycurl.SSL_VERIFYHOST, False)
c.perform()
def errormessage():
print "Invalid Syntax.\n\nUsage: 'Sightshell port user:password arm-or-disarm camera_name'\nExample: Sightshell 8080 frank:zappa arm bedroom"
if method != 'arm' and method != 'disarm':
errormessage()
sys.exit()
if method == 'arm':
config ='<?xml version="1.0"?><methodCall><methodName>enableCamera</methodName><params><param><value><string>' + camera + '</string></value></param><param><value><boolean>1</boolean></value></param></params></methodCall>'
command()
sys.exit()
if method == 'disarm':
config ='<?xml version="1.0"?><methodCall><methodName>enableCamera</methodName><params><param><value><string>' + camera + '</string></value></param><param><value><boolean>0</boolean></value></param></params></methodCall>'
command()
sys.exit()
To run it, launch the command:
- Code: Select all
Sightshell.py port user:password (arm or disarm) Camera_name
for example:
- Code: Select all
Sightshell.py 8080 bugsbunny:carrots arm Bedroom
