Skip to content

Instantly share code, notes, and snippets.

@papr
Last active January 17, 2022 13:42
Show Gist options
  • Save papr/83345454eca4794a298ca7d798b4587f to your computer and use it in GitHub Desktop.
Save papr/83345454eca4794a298ca7d798b4587f to your computer and use it in GitHub Desktop.
Python script to turn off the Pupil Capture world camera via the Network API
msgpack>=1.0.0
pyzmq
import zmq
import msgpack
if __name__ == "__main__":
# Setup zmq context and remote helper
ctx = zmq.Context()
socket = zmq.Socket(ctx, zmq.REQ)
socket.connect("tcp://127.0.0.1:50020")
# send notification:
def notify(notification):
"""Sends ``notification`` to Pupil Remote"""
topic = "notify." + notification["subject"]
payload = msgpack.dumps(notification, use_bin_type=True)
socket.send_string(topic, flags=zmq.SNDMORE)
socket.send(payload)
return socket.recv_string()
notify(
{
"subject": "start_plugin",
"name": "UVC_Source",
"args": {"frame_size": (1280, 720), "frame_rate": 30, "name": "Turned off"},
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment