Changes between Version 138 and Version 139 of UserGuideGit


Ignore:
Timestamp:
Mar 2, 2009, 1:01:22 PM (16 years ago)
Author:
Frédéric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuideGit

    v138 v139  
    151151== Tethered shooting ==
    152152
    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 on 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:
     153It 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 on 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. Note that if a function does not exists, the internal one will be called instead.
     154
     155Here is a minimalistic example script which can be used:
    156156
    157157{{{
     
    160160
    161161def mirrorLockup(stabilizationDelay):
    162     print "Mirror lockup (stabilizationDelay=%.1f)" % stabilizationDelay
    163162    # See shoot() function
    164163
    165164
    166165def shoot(bracketNumber):
    167     print "Shoot (bracketNumber=%d)" % bracketNumber
    168 
    169     # Launch external command
    170     #p = subprocess.Popen(["myTetheredShootingProgram", "-capture", "%d" % bracketNumber], 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
     166
     167    # Launch the external command
     168    p = subprocess.Popen(["gphoto2", "--help"], stdout=subprocess.PIPE)
     169
     170    # Wait end of execution
    177171    p.wait()
    178172
    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,
     173    # Return result (must be a tuple containing an int and a string)
     174    return p.returncode, p.stdout.read()
    187175}}}
    188176