jitty-scripts/doppler.sh

46 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/sh
# doppler.sh
RADAR_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"
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
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}..."
${LINK_DOWNLOADER} ${FORECAST_URL}
;;
-ft | forecast-terminal)
notify-send "Getting forecast from ${FORECAST_URL}..."
${TERMINAL_APP} ${TERMINAL_OPTS} ${LINK_DOWNLOADER} ${FORECAST_URL}
;;
-h | help | --help)
echo -e "\nUsage: ${0} [-f | forecast ], [-ft, forecast-terminal], [-h, help, --help]\n"
;;
*)
notify-send "Getting radar image" "please wait..."
${VIDEO_PLAYER} --loop=inf "${RADAR_IMAGE_URL}"
;;
esac