#!/bin/sh # # You can change the following to configure defaults. # # Default location of GPX files. # # Examples: # #DEFAULT_GPXDIR=$HOME/gpx #DEFAULT_GPXDIR=. #DEFAULT_GPXDIR=/var/gps/data DEFAULT_GPXDIR=. # # You can change the rest too. # if [ X$DEFAULT_GPXDIR == X"." ]; then gpxdirhelp="Search in current directory" else gpxdirhelp=$DEFAULT_GPXDIR fi gpxarg="--gpsdir=$DEFAULT_GPXDIR" overwrite="--overwrite-geotagged" helpme=false offsetarg="guess" args=$(getopt dhg:o: $*) set -- $args while [ $# -ge 0 ]; do case "$1" in -o) offsetarg="--timeoffset=$(($2*3600))"; shift; shift;; -g) gpxarg="--gpsdir=$2"; shift; shift;; -d) overwrite=""; shift; shift;; -h) helpme=true; break;; --) shift; break;; esac done if [ $? -ne 0 -o X"$*" == X -o X$helpme == Xtrue ]; then echo "Usage: geoTag [-f] [-g ] [-o ] " echo " -d Do not overwrite existing GPS data" echo " (Default: Do it)" echo " -g Directory to look for GPX files in" echo " (Default: $gpxdirhelp)" echo " -o Camera offset in hours" echo " (Default: Guess from coordinates)" exit fi if [ X"$offsetarg" = Xguess ]; then for image; do offset=$( /usr/opt/bin/gpsPhoto.pl --tz-guess=zone.tab $gpxarg -i $image \ | grep -- "--timeoffset=" \ | sed 's/.*--timeoffset=\([-0-9]*\)/\1/' ) offsetarg="--timeoffset=$offset" echo "===============================" echo " Offset: $offset seconds" echo "===============================" break; done fi image_list=$(mktemp) for image; do echo $image>>$image_list done /usr/opt/bin/gpsPhoto.pl \ --interpolate=linear \ -I $image_list \ $overwrite \ $gpxarg \ $offsetarg /usr/opt/bin/gpsPlacenamePhoto.pl $* exit