Skip to content

Instantly share code, notes, and snippets.

@tuxflo tuxflo/applygeobookmark.sh
Last active Jun 27, 2017

Embed
What would you like to do?
Dolphin Geotag Service Menu
#!/usr/bin/env bash
lat=$1
if (( $(echo "$lat > 0" |bc -l) )); then
latref="N"
else
latref="S"
fi
lon=$2
if (( $(echo "$lon > 0" |bc -l) )); then
lonref="E"
else
lonref="W"
fi
echo "${@:3}"
for var in "${@:3}"
do exiftool -overwrite_original -GPSLatitude=$lat -GPSLatitudeRef=$latref -GPSLongitude=$lon -GPSLongitudeRef=$lonref $var
kdialog --icon=/usr/share/icons/hicolor/scalable/apps/ks-resize-image.svgz --title="Set Geotag" --passivepopup="[Finished] $var"
done
# Geotag selected images
[Desktop Entry]
Type=Service
Encoding=UTF-8
Actions=geotag;bookmark1
X-KDE-Priority=TopLevel
MimeType=image/*;
ServiceTypes=KonqPopupMenu/Plugin
Type=Service
X-KDE-Priority=TopLevel
X-KDE-StartupNotify=false
X-KDE-Submenu=Set Geotag
[Desktop Action geotag]
Exec=/usr/local/bin/geotag.sh %F
Name=Set Getotag
[Desktop Action bookmark1]
Exec=/usr/local/bin/applygeobookmark.sh 40.705565 -74.1180865 %F
Name=New York
#!/usr/bin/env bash
wget -q --spider http://maps.googleapis.com/
if [ $? -ne 0 ]; then
kdialog --icon=/usr/share/icons/hicolor/scalable/apps/ks-resize-image.svgz --title="Error" --passivepopup="Google Maps is not reachable. Check your Internet connection."
exit 1
fi
out=$(kdialog --inputbox 'Enter city:' --title 'Enter city for the geotag')
if [ $? -ne 0 ]; then
exit 1
fi
replaced=${out// /%20}
lat=$(curl -sS -G -k --data "address=$replaced&sensor=false" http://maps.googleapis.com/maps/api/geocode/json | jq '.results[0].geometry.location.lat')
if (( $(echo "$lat > 0" |bc -l) )); then
latref="N"
else
latref="S"
fi
lon=$(curl -sS -G -k --data "address=$replaced&sensor=false" http://maps.googleapis.com/maps/api/geocode/json | jq '.results[0].geometry.location.lng')
if (( $(echo "$lon > 0" |bc -l) )); then
lonref="E"
else
lonref="W"
fi
for var in "$@"
do exiftool -overwrite_original -GPSLatitude=$lat -GPSLatitudeRef=$latref -GPSLongitude=$lon -GPSLongitudeRef=$lonref $var
kdialog --icon=/usr/share/icons/hicolor/scalable/apps/ks-resize-image.svgz --title="Set Geotag" --passivepopup="[Finished] $var"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.