Strip a trailing space
[JMPrope_player.git] / contrib / gphoto2_capture.sh
1 #!/bin/sh
2 #
3 # gphoto2_capture.sh - Do automated high exposure tethered photo shoots
4 #
5 # Copyright (C) 2014  Antonio Ospite <ao2@ao2.it>
6 #
7 # This program is free software. It comes without any warranty, to
8 # the extent permitted by applicable law. You can redistribute it
9 # and/or modify it under the terms of the Do What The Fuck You Want
10 # To Public License, Version 2, as published by Sam Hocevar. See
11 # http://sam.zoy.org/wtfpl/COPYING for more details.
12
13 set -e
14
15 # Get the configuration variables with these commands:
16 # gphoto2 --set-config capture=1
17 # gphoto2 --list-all-config | sed -e 's/^[^\/]/\t\0/g' > Camera-config.txt
18 #
19
20 CAPTURE_MODE=$(LANG=C gphoto2 --get-config capture | grep Current | cut -d ' ' -f 2 | tr -d '\n')
21
22 if [ "x$CAPTURE_MODE" = "x" ];
23 then
24   exit 1
25 fi
26
27 if [ $CAPTURE_MODE -eq 0 ];
28 then
29   gphoto2 --set-config capture=1
30 fi
31
32 # The settings below are for a Canon powershot A85, with these settings:
33 #   - Save pictures on the memory card
34 #   - F-number 2.8
35 #   - Manual shooting mode
36 #   - Exposure 0.5 seconds
37 #   - Superfine quality
38 #   - ISO speed 100
39
40 gphoto2 \
41   -I 1 \
42   --set-config-index capturetarget=1 \
43   --set-config-index /main/capturesettings/aperture=0 \
44   --set-config-index /main/capturesettings/shootingmode=3 \
45   --set-config-index /main/capturesettings/shutterspeed=15 \
46   --set-config-index /main/imgsettings/imagequality=2 \
47   --set-config-index /main/imgsettings/iso=1 \
48   --capture-image \
49   "$@"
50
51 # Stop the capture with Ctrl-C and then download all the files on the PC,
52 # after that delete them from the camera:
53 # gphoto2 --get-all-files
54 # gphoto2 --delete-all-files --recurse