| | 151 | == Tethered shooting == |
| | 152 | |
| | 153 | It is possible to use an external program to make tethered shooting. The program needs to be run through a shell, where all parameters are given in command-line. If a '''{{{shoot.py}}}''' python script is found in the user config. dir, the 2 functions '''{{{mirrorLockup(stabilizationDelay))}}}''' and '''{{{shoot(bracketNumber)}}}''' will be called instead of internal ones. |
| | 154 | |
| | 155 | Here is an example script which can be used: |
| | 156 | |
| | 157 | {{{ |
| | 158 | #!python |
| | 159 | import subprocess |
| | 160 | |
| | 161 | def mirrorLockup(delay): |
| | 162 | print "Mirror lockup (delay=%.1f)" % delay |
| | 163 | # See shoot() function |
| | 164 | |
| | 165 | |
| | 166 | def shoot(bracket): |
| | 167 | print "Shoot (bracket=%d)" % bracket |
| | 168 | |
| | 169 | # Launch external command |
| | 170 | #p = subprocess.Popen(["myTetheredShootingProgram", "-capture", "%d" % bracket], stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
| | 171 | p = subprocess.Popen(["gphoto2", "--help"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
| | 172 | |
| | 173 | # Send data to external command input |
| | 174 | #p.stdin.write("bla") |
| | 175 | |
| | 176 | # Wait end of external command execution |
| | 177 | p.wait() |
| | 178 | |
| | 179 | # Print external command return code |
| | 180 | print "returncode=%d" % p.returncode |
| | 181 | |
| | 182 | # Print external command output |
| | 183 | print p.stdout.read() |
| | 184 | #print p.stdout.readlines() |
| | 185 | #for line in p.stdout: |
| | 186 | #print line, |
| | 187 | }}} |
| | 188 | |
| | 189 | More informations about ''subprocess'' module usage can be found here: |
| | 190 | |
| | 191 | * [http://www.python.org/doc/2.5.4/lib/node528.html] |
| | 192 | * [http://www.python.org/doc/2.5.4/lib/node532.html] |
| | 193 | |