From 305c6bcd96668a81664587c85afcf00c23852245 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Tue, 14 Nov 2023 13:28:21 +0100 Subject: [PATCH] GPS data -add option to erase GPS data --- keywords2insta.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/keywords2insta.sh b/keywords2insta.sh index 97b5f83..843e7e1 100755 --- a/keywords2insta.sh +++ b/keywords2insta.sh @@ -23,6 +23,9 @@ others=() insta=true flickr=true +gps=0 +opt_gps=true + opt_others=false opt_lens=false opt_model=false @@ -69,7 +72,7 @@ alpha () { } showHelp() { - echo -e "${greenbold}keywords2insta${reset} v1.1" + echo -e "${greenbold}keywords2insta${reset} v2.1" echo -e "Bruno " echo -e "Read exif and keywords from an image file, and copy them to the clipboard, " echo -e " ready for Instagram and Flickr." @@ -247,6 +250,9 @@ lens=$(echo "$exif" | jq -j '.[] | .Lens | select( . != null )') lensID=$(echo "$exif" | jq -j '.[] | .LensID | select( . != null )') lensModel=$(echo "$exif" | jq -j '.[] | .LensModel | select( . != null )') focal=$(echo "$exif" | jq -j '.[] | .FocalLength | select( . != null )') +latitude=$(echo "$exif" | jq -j '.[] | .GPSLatitude | select( . != null )') +longitude=$(echo "$exif" | jq -j '.[] | .GPSLongitude | select( . != null )') +altitude=$(echo "$exif" | jq -j '.[] | .GPSAltitude | select( . != null )') echo if [[ -n $iso ]] && [[ -n $speed ]] && [[ -n $aperture ]]; then @@ -272,9 +278,36 @@ if [[ -n $iso ]] && [[ -n $speed ]] && [[ -n $aperture ]]; then printf " %-10s %-35s \n" "Lens:" "${lens}" l="$lens" fi + if [[ -n $latitude ]] && [[ -n $longitude ]]; then + printf " %-10s %-35s \n" "Latitude:" "${latitude}" + printf " %-10s %-35s \n" "Longitude:" "${longitude}" + printf " %-10s %-35s \n" "Altitude:" "${altitude}" + gps=1 + fi echo + fi +# gps +if [ $opt_gps = true ]; then + if [ $gps -eq 1 ]; then + echo "GPS data available !" + + a=$(echo -e "Do you want to ${bold}erase GPS data${reset} ? (k)eep or (e)rase ") + read -p "$a" choice + + if [ "$choice" == "e" ] || [ "$choice" == "E" ]; then + echo "Erasing GPS data..." + exiftool -gps:all= "$file" + fi + fi +else + # erase GPS data + echo "Erasing GPS data..." + exiftool -gps:all= "$file" +fi + + # keywords k=$(echo "$exif" | jq --compact-output --raw-output '.[] | .Keywords[]?' | tr "\n" "," | sed 's/\,$//') #k=$(echo "$exif" | sed -n '/^Keywords/p' | awk -F":" '{print $2}' | sed 's/^ *//g')