commit 027e5b129d51a378f223891e86a11316cf9cdc92
parent 62410b2f445dd8f3af923ed3d9161afe39c4e227
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Tue, 14 Aug 2018 15:57:34 +0200
Update bookmarks and add optional arguments to forecast
Diffstat:
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/links/.w3m/bookmark.html b/links/.w3m/bookmark.html
@@ -91,6 +91,8 @@
<ul>
<li><a href="https://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=9520&mode=long&eps=true">DMI:
Skoerping 48h</a>
+ <li><a href="https://servlet.dmi.dk/byvejr/servlet/byvejr?by=9520&tabel=dag3_9&eps=true">DMI:
+ Skoerping 3-9d</a>
<li><a href="http://www.dmi.dk/vejr/maalinger/radar-nedboer/">DMI: Radar</a>
<!-- <li><a href="http://f1.weather.gov/MapClick.php?lat=40.33075000000008&lon=-74.56472999999994">National Weather Service: Plainsboro, NJ</a> -->
<!-- <li><a href="http://f1.weather.gov/MapClick.php?w0=t&w1=td&w2=wc&w3=sfcwind&w3u=3&w4=sky&w5=pop&w6=rh&w7=rain&w8=thunder&w9=snow&w10=fzg&w11=sleet&w12=fog&w13u=0&w16u=1&w17u=1&AheadHour=0&Submit=Submit&FcstType=graphical&textField1=40.3308&textField2=-74.5647&site=all&unit=0&dd=&bw=&menu=1">NWS: Hourly Weather Forecast, Plainsboro NJ (Graphical)</a> -->
diff --git a/links/bin/forecast b/links/bin/forecast
@@ -1,21 +1,35 @@
#!/bin/bash -e
# vim: ft=sh:
+set -e
# DMI
#zipcode=7700 # Thisted
zipcode=9520 # Skoerping
-url="https://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=$zipcode&mode=long&eps=true"
+url="https://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=${zipcode}&mode=long&eps=true"
# NWS: Plainsboro
#url='http://f1.weather.gov/meteograms/Plotter.php?lat=40.3308&lon=-74.5647&wfo=PHI&zcode=NJZ012&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=0&pcmd=11011111111110100000000000000000000000000000000000000000000&lg=en&indu=3!1!1!&dd=&bw=&hrspan=48&pqpfhr=6&psnwhr=6'
-tmpfile=$(mktemp).png
-curl --location "$url" \
- --output "$tmpfile"
if command -v open &>/dev/null; then
- open "$tmpfile"
+ open=open
elif command -v xdg-open &>/dev/null; then
- xdg-open "$tmpfile"
+ open=xdg-open
else
- echo "$tmpfile"
+ open="echo"
+fi
+
+if [ $# -gt 0 ]; then
+ if [ "$1" == "radar" ]; then
+ $open "http://www.dmi.dk/vejr/maalinger/radar-nedboer/"
+ exit 0
+ elif [ "$1" == "3-9" ]; then
+ url="https://servlet.dmi.dk/byvejr/servlet/byvejr?by=${zipcode}&tabel=dag3_9&eps=true"
+ fi
fi
+
+tmpfile=$(mktemp).png
+curl --location "$url" \
+ --output "$tmpfile"
+$open "$tmpfile"
+
+#http://servlet.dmi.dk/byvejr/servlet/byvejr?by=9520&tabel=dag3_9&eps=true