-add option to erase GPS data
This commit is contained in:
2023-11-14 13:28:21 +01:00
parent 464ce8987c
commit 305c6bcd96

View File

@@ -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 <bruno<clicclac.info>"
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')