wviewweather.com Forum Index wviewweather.com
wview and Weather Topics
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Summary Graphic

 
Post new topic   Reply to topic    wviewweather.com Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
loonsailor



Joined: 05 Feb 2006
Posts: 15

PostPosted: Sat Jul 22, 2006 9:57 am    Post subject: Summary Graphic Reply with quote

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
View user's profile Send private message
bhnb



Joined: 28 Nov 2005
Posts: 127

PostPosted: Sun Jul 23, 2006 2:33 am    Post subject: Reply with quote

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
View user's profile Send private message
loonsailor



Joined: 05 Feb 2006
Posts: 15

PostPosted: Sun Jul 23, 2006 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
loonsailor



Joined: 05 Feb 2006
Posts: 15

PostPosted: Sun Jul 23, 2006 10:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
bhnb



Joined: 28 Nov 2005
Posts: 127

PostPosted: Fri Jul 28, 2006 11:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    wviewweather.com Forum Index -> Wish List All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group