Location Remembering #2
1 changed files with 11 additions and 0 deletions
|
@ -9,9 +9,20 @@ irc | while read -r n m; do
|
|||
place="$(m 1)"
|
||||
elif hreg '^#(?:temp|temperature|weather) (.*)$' "$m"; then
|
||||
place="$(m 1)"
|
||||
elif hreg '^#at (.*)$' "$m"
|
||||
place="$(m 1)"
|
||||
if grep -q "^$n," places.csv; then
|
||||
sed 's|^'"$n"',.*|'"$n,$place"'|' > places-new.csv
|
||||
mv -f places-new.csv places.csv
|
||||
else
|
||||
printf '%s,%s' "$n" "$place" >> places.csv
|
||||
fi
|
||||
else
|
||||
continue;
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
place=$(awk -F, -v "n=$n" '$1==n{print $2}' places.csv)
|
||||
fi
|
||||
plason="$(curl -s -g -G --data-urlencode "q=$place" --data-urlencode 'format=json' 'https://nominatim.openstreetmap.org/search')"
|
||||
if [ "x$plason" == "x[]" ]; then
|
||||
answer="Could not find location: $place"
|
||||
|
|
Loading…
Add table
Reference in a new issue