Little optimizations (#1138)
This commit is contained in:
parent
f25687ad78
commit
c20acc474f
1 changed files with 11 additions and 8 deletions
|
@ -240,16 +240,19 @@ DE: SHH: Schleswig-Holstein
|
||||||
DE: SHH: Hamburg
|
DE: SHH: Hamburg
|
||||||
DE: THU: Thuringia" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")"
|
DE: THU: Thuringia" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")"
|
||||||
|
|
||||||
# Set continent code and radar code.
|
# Ensure user did not escape.
|
||||||
continentcode=$(echo "$chosen" | sed "s/:.*//")
|
[ -z "$chosen" ] && exit 1
|
||||||
radarcode=$(echo "$chosen" | sed "s/..: // ; s/:.*//")
|
|
||||||
|
|
||||||
# Sanity check of selection and ensure user did not escape.
|
# Set continent code and radar code.
|
||||||
echo "$radarcode" | grep -q "^[A-Z]\+$" && printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc" ;}
|
continentcode=${chosen%%:*}
|
||||||
|
radarcode=${chosen#* } radarcode=${radarcode%:*}
|
||||||
|
|
||||||
|
# Print codes to $radarloc file.
|
||||||
|
printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc" ;}
|
||||||
|
|
||||||
getdoppler() {
|
getdoppler() {
|
||||||
cont="$(sed "s/,.*//" "$radarloc")"
|
cont=$(cut -c -2 "$radarloc")
|
||||||
loc="$(cut -c 4- "$radarloc")"
|
loc=$(cut -c 4- "$radarloc")
|
||||||
notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
|
notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc."
|
||||||
case "$cont" in
|
case "$cont" in
|
||||||
"US") curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;;
|
"US") curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;;
|
||||||
|
|
Loading…
Reference in a new issue