View previous topic :: View next topic |
Author |
Message |
loonsailor
Joined: 05 Feb 2006 Posts: 15
|
Posted: Sat Jul 22, 2006 9:57 am Post subject: Summary Graphic |
|
|
It would be very nice to have a weather summary png that I could stick on a page, so that the user could see updated weather on a page that is not autogenerated by wview. Here's a very nice example, which is generated by Virtual Weather Station.
|
|
Back to top |
|
|
bhnb
Joined: 28 Nov 2005 Posts: 127
|
Posted: Sun Jul 23, 2006 2:33 am Post subject: |
|
|
Hi
Here's a script which uses ImageMagick to create a very very simple single-image summary called current.gif. You need to have parameterlist.txt in htmlgen.conf.
Code: | #!/bin/sh
# script to make wview readings available to scripts.
# works by pasting together before and after versions of parameterlist
# readings are referenced by their wview names e.g. outdoorTemp becomes $outdoorTemp
WVIMG=/var/wview/img
WVHTML=/etc/wview/html
# line for yearly rain line is non-standard, so standardise it...
sed -e 's/ \/\/ yearly rain//' ${WVHTML}/parameterlist.txt > /tmp/param1.txt
sed -e 's/ \/\/ yearly rain//' ${WVIMG}/parameterlist.htm > /tmp/param2.txt
# paste together before and after..
paste -d==\" /tmp/param1.txt /tmp/param2.txt |
sed -e 's/^<!--//g' -e 's/-->=/=\"/g' -e 's/$/"/' -e 's/^="$//g' > /tmp/param.txt
# source the file we've just created
. /tmp/param.txt
# the readings are now available, do something with them.
convert -size 300x100 xc:skyblue \
-annotate 0x0+5+15 "${stationState}, ${stationCity} weather" \
-annotate 0x0+5+30 "Outside temperature: ${outsideTemp} ${tempUnit}" \
-annotate 0x0+5+45 "High temp: ${hiOutsideTemp}${tempUnit} at ${hiOutsideTempTime}" \
-annotate 0x0+5+60 "Barometer: ${barometer}" \
-annotate 0x0+5+90 "Time: ${stationTime} ${stationDate}" \
${WVIMG}/current.gif
|
|
|
Back to top |
|
|
loonsailor
Joined: 05 Feb 2006 Posts: 15
|
Posted: Sun Jul 23, 2006 9:24 am Post subject: |
|
|
Thanks! I wasn't familiar with ImageMagick, but this plus one or two of the existinng graphics should do the job.
Do you just execute this script from a cron entry? |
|
Back to top |
|
|
loonsailor
Joined: 05 Feb 2006 Posts: 15
|
Posted: Sun Jul 23, 2006 10:30 pm Post subject: |
|
|
Thanks for the script, but I don't see how to edit htmlgen.conf in order to get it to generate parameterlist.html. There is a copy of parameterlist.txt in /etc/wview/html, but just putting it there doesn't seem to be enough to generate the html file.
Thanks |
|
Back to top |
|
|
bhnb
Joined: 28 Nov 2005 Posts: 127
|
Posted: Fri Jul 28, 2006 11:03 am Post subject: |
|
|
You need to put it in html-templates.conf and either send htmlgend a HUP or do a restart.
In your thread about ftp problems I mentioned that I use a script at /usr/bin/ftp to do my upload. Part of the same script also does various image manipulation things just before the upload. If I didn't use that method then yes, I'd probably use cron. |
|
Back to top |
|
|
|