A Python client for the pktriggercord server, allowing remote control of Pentax DSLR cameras.
I'm not a very good programmer, so if this breaks your camera it's not my fault. I've tried to put in some protections to stop you from doing anything really stupid (e.g. overflowing the camera's buffer).
This has only been tested with a Pentax K-5 IIs, if you test another camera that pktriggercord supports then let let me know.
Dependencies: pktriggercord (on server), rich (on client), nerd-fonts (on client)
git clone https://github.com/asalamon74/pktriggercord.git
cd pktriggercord
make clean
make
sudo make installpip3 install richPlug your camera into a computer, switch the camera on, and run:
pktriggercord-cli --servermodeOn the either the same computer or on a seperate computer, run:
python3 pkclient.pyCaution
The camera's buffer can only hold 9 images at once.1 If you try to write more without deleting any buffers your camera will stop working until you perform a hard reset by pulling the battery.
pk = pkclient("127.0.0.1", 8888) # connect local or remote
pk.connect_server()
pk.connect_camera()
pk.get_camera_name()
pk.focus()
pk.set_aperture(2.8)
pk.set_shutter_speed("1/4")
pk.set_iso(800)
pk.delete_buffer(0) # so you know your next photo will be in buffer 0
pk.get_buffer_type()
pk.set_buffer_type("DNG") # can be DNG or PEF
pk.shutter()
pk.get_buffer(0, "photograph_0") # save image to CWD
pk.stop_server()- more robust buffer protection
- test more
- better error detection
- quiet option
- no-frills version (no rich or nerd-fonts)
Footnotes
-
This is true of the K-5 IIs, a safe way to test if buffer
nexists is by usingpk.delete_buffer(n)and seeing if an error is reported server side ↩
