Update SDK build tools to 24.0.1
[termux-packages] / packages / termux-api / termux-camera-photo
CommitLineData
cc1ae02e 1#!/bin/sh
59f0d218
FF
2set -e -u
3
bea93fbd 4SCRIPTNAME=termux-camera-photo
59f0d218 5show_usage () {
bea93fbd
FF
6 echo "Usage: termux-camera-photo [-c camera-id] output-file"
7 echo "Take a photo and save it to a file in JPEG format."
8 echo ""
9 echo " -c camera-id ID of the camera to use (see termux-camera-info), default: 0"
10 echo ""
11 exit 0
59f0d218
FF
12}
13
bea93fbd 14
2aa217bf 15PARAMS=""
bea93fbd
FF
16while getopts :hc: option
17do
18 case "$option" in
19 h) show_usage;;
20 c) PARAMS="--es camera $OPTARG";;
21 ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1;
22 esac
59f0d218 23done
bea93fbd 24shift $(($OPTIND-1))
59f0d218 25
bea93fbd
FF
26if [ $# = 0 ]; then echo "$SCRIPTNAME: missing file argument"; exit 1; fi
27if [ $# != 1 ]; then echo "$SCRIPTNAME: too many arguments"; exit 1; fi
2e395b58 28
59f0d218 29touch $1
2aa217bf 30PARAMS="$PARAMS --es file `realpath $1`"
59f0d218 31
cc1ae02e 32@TERMUX_API@ CameraPhoto $PARAMS