doppler.sh: add forecast options, clean code
This commit is contained in:
parent
167eaf8c95
commit
6a6616cfbc
31
doppler.sh
31
doppler.sh
@ -1,7 +1,12 @@
|
||||
#!/bin/sh
|
||||
# doppler.sh
|
||||
|
||||
IMAGE_URL="https://radar.weather.gov/lite/N0R/FSX_loop.gif"
|
||||
VIDEO_PLAYER=/usr/bin/mpv
|
||||
LINK_DOWNLOADER=/usr/bin/curl
|
||||
FORECAST_URL="wttr.in"
|
||||
TERMINAL_APP=/usr/bin/xterm
|
||||
TERMINAL_OPTS="-maximized -hold -e"
|
||||
|
||||
if [[ ! -f "${VIDEO_PLAYER}" ]];then
|
||||
echo "${VIDEO_PLAYER} not found"
|
||||
@ -10,5 +15,27 @@ if [[ ! -f "${VIDEO_PLAYER}" ]];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
notify-send "Getting radar image" "please wait..."
|
||||
${VIDEO_PLAYER} --loop=inf "${IMAGE_URL}"
|
||||
if [[ ! -f "${LINK_DOWNLOADER}" ]];then
|
||||
echo "${VIDEO_PLAYER} not found"
|
||||
echo "Please install it with your system's package manager"
|
||||
notify-send "${VIDEO_PLAYER} not found" "Please install it with your system's package manager"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
|
||||
|
||||
-f | forecast)
|
||||
echo "Getting forecast from ${FORECAST_URL}..."
|
||||
${TERMINAL_APP} ${TERMINAL_OPTS} ${LINK_DOWNLOADER} ${FORECAST_URL}
|
||||
;;
|
||||
|
||||
-h | help | --help)
|
||||
echo -e "\nUsage: ${0} [-f | forecast ], [-h, help, --help]\n"
|
||||
;;
|
||||
|
||||
*)
|
||||
notify-send "Getting radar image" "please wait..."
|
||||
${VIDEO_PLAYER} --loop=inf "${IMAGE_URL}"
|
||||
;;
|
||||
esac
|
||||
|
Loading…
x
Reference in New Issue
Block a user