Merge branch 'patch-1' of https://github.com/Secondarian/voidrice into Secondarian-patch-1

This commit is contained in:
Luke Smith 2022-07-01 21:29:39 -04:00
commit d21e975479

View file

@ -4,8 +4,29 @@
secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds. secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds.
radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar"
radarger="${XDG_CACHE_HOME:-$HOME/.cache}/radarger"
doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif"
pickger() { chosenger="$(echo "BAW: Baden-Württemberg
BAY: Bavaria
BBB: Berlin
BBB: Brandenburg
HES: Hesse
MVP: Mecklenburg-Western Pomerania
NIB: Lower Saxony
NIB: Bremen
NRW: North Rhine-Westphalia
RPS: Rhineland-Palatinate
RPS: Saarland
SAC: Saxony
SAA: Saxony-Anhalt
SHH: Schleswig-Holstein
SHH: Hamburg
THU: Thuringia" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | sed "s/:.*//" | tr "[:upper:]" "[:lower:]")"
# Secondary sanity check of selection and ensure user did not escape for Germany.
echo "$chosenger" | grep -q "[a-z]" && echo "$chosenger" > "$radarger" ;}
pickloc() { chosen="$(echo "US: Northeast pickloc() { chosen="$(echo "US: Northeast
US: Southeast US: Southeast
US: PacNorthWest US: PacNorthWest
@ -229,20 +250,27 @@ continentcode=$(echo "$chosen" | sed "s/:.*//")
radarcode=$(echo "$chosen" | sed "s/..: // ; s/:.*//") radarcode=$(echo "$chosen" | sed "s/..: // ; s/:.*//")
# Sanity check of selection and ensure user did not escape. # Sanity check of selection and ensure user did not escape.
echo "$radarcode" | grep -q "^[A-Z]\+$" && printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc" ;} echo "$radarcode" | grep -q "^[A-Z]\+$" && printf "%s,%s\\n" "$continentcode" "$radarcode" > "$radarloc"
getdoppler() { # Prompts for choosing region if in Germany.
cont="$(sed "s/,.*//" "$radarloc")" case $(cut -c 4- "$radarloc") in
DE) pickger ;;
*) ;;
esac ;}
getdoppler() { cont="$(sed "s/,.*//" "$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"
if [ "$cont" = "US" ] ; then case $cont in
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" ;;
elif [ "$cont" = "EU" ] ; then EU) case $loc in
curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ; DE) [ ! -f "$radarger" ] && pickger
elif [ "$cont" = "AF" ] ; then ger="$(cat "$radarger")"
curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ; curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${ger}_akt.gif" > "$doppler" ;;
fi *) curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" > "$doppler" ;;
} esac ;;
AF) curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" > "$doppler" ;;
esac ;}
showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;} showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;}