42 lines
1.0 KiB
Bash
Executable File
42 lines
1.0 KiB
Bash
Executable File
#!/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"
|
|
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}..."
|
|
${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
|