diff --git a/doppler.sh b/doppler.sh index 3d079b2..08e2d5c 100755 --- a/doppler.sh +++ b/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