コード例 #1
0
    return ret


def reset_settings():
    log('reseting settings')
    run("gphoto2 --set-config /main/capturesettings/flashmode=1")
    run("gphoto2 --set-config /main/capturesettings/focusmode=0")


reset_settings()

while True:
    t = datetime.utcnow()

    # only take pictures when it is light out
    if sun.is_light(t):
        reset_nikon()
        take_picture()
    else:
        print "Waiting for the sun to come out"

    # remove the picture from camera memory since there isn't much there
    reset_nikon()
    delete_picture()

    # wait for 1 minute
    # we can't just do sleep(5 * 60) because taking the picture takes time
    print datetime.utcnow(), 'waiting ...'
    while datetime.utcnow() < t + DELTA:
        time.sleep(1)
コード例 #2
0
ファイル: timelapse.py プロジェクト: dwiel/gphoto2-timelapse
      ret, stdout, stderr = run("gphoto2 --delete-file=1 --folder=/")
  
  return ret

def reset_settings() :
  log('reseting settings')
  run("gphoto2 --set-config /main/capturesettings/flashmode=1")
  run("gphoto2 --set-config /main/capturesettings/focusmode=0")

reset_settings()

while True :
  t = datetime.utcnow()
  
  # only take pictures when it is light out
  if sun.is_light(t) or ignore_sun:
    reset_nikon()
    take_picture()
  else :
    print "Waiting for the sun to come out"  
  
  # remove the picture from camera memory since there isn't much there
  # doing this even if we're waiting for the sun, hoping that it will keep
  # the camera awake
  reset_nikon()
  delete_picture()
  
  # wait for 1 minute
  # we can't just do sleep(5 * 60) because taking the picture takes time
  print datetime.utcnow(), 'waiting ...'
  while datetime.utcnow() < t + DELTA :
コード例 #3
0
    sys.exit()

# Display high-level information
logger.info('Taking a total of %d shots, and waiting %s between each shot',
            shootInfo.nbShots, str(shootInfo.delay))
logger.info('Each shot will have %d exposure(s)', len(shootInfo.exposures))

initialize()

nbShots = 0
# loop until we have the required number of shots
while nbShots < shootInfo.nbShots:
    tInit = datetime.utcnow()

    # only take pictures when it is light out
    if shootInfo.ignoreSun or sun.is_light(tInit):
        # reset_camera()
        takeShot()
        nbShots += 1
    else:
        logger.info('Waiting for the sun to come out')

    if nbShots < shootInfo.nbShots:
        # wait only if we still need to shoot
        tCur = datetime.utcnow()

        tDelay = tCur - tInit
        if tDelay < shootInfo.delay:
            # wait only if the delay is larger than the time it took to take the shot (gphoto2 can be quite slow)
            waitTime = shootInfo.delay - tDelay
コード例 #4
0
  sys.exit()

# Display high-level information
logger.info('Taking a total of %d shots, and waiting %s between each shot', 
            shootInfo.nbShots, str(shootInfo.delay))
logger.info('Each shot will have %d exposure(s)', len(shootInfo.exposures))
  
initialize()

nbShots = 0
# loop until we have the required number of shots
while nbShots < shootInfo.nbShots:
  tInit = datetime.utcnow()
  
  # only take pictures when it is light out
  if shootInfo.ignoreSun or sun.is_light(tInit):
    # reset_camera()
    takeShot()
    nbShots += 1
  else :
    logger.info('Waiting for the sun to come out')
  
  if nbShots < shootInfo.nbShots:
    # wait only if we still need to shoot
    tCur = datetime.utcnow()
  
    tDelay = tCur - tInit
    if tDelay < shootInfo.delay:
      # wait only if the delay is larger than the time it took to take the shot (gphoto2 can be quite slow)
      waitTime = shootInfo.delay - tDelay
    
コード例 #5
0
      ret, stdout, stderr = run("gphoto2 --delete-file=1 --folder=/")
  
  return ret

def reset_settings() :
  log('reseting settings')
  run("gphoto2 --set-config /main/capturesettings/flashmode=1")
  run("gphoto2 --set-config /main/capturesettings/focusmode=0")

reset_settings()

while True :
  t = datetime.utcnow()
  
  # only take pictures when it is light out
  if sun.is_light(t) :
    reset_nikon()
    take_picture()
  else :
    print "Waiting for the sun to come out"
  
  # remove the picture from camera memory since there isn't much there
  reset_nikon()
  delete_picture()
  
  # wait for 1 minute
  # we can't just do sleep(5 * 60) because taking the picture takes time
  print datetime.utcnow(), 'waiting ...'
  while datetime.utcnow() < t + DELTA :
    time.sleep(1)