[SimBot-commits] CVS: simbot/plugins weather.pl,1.73,1.74
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2005-05-07 15:36:00
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17189/plugins Modified Files: weather.pl Log Message: We now request the alerts file compressed. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -p -r1.73 -r1.74 --- weather.pl 7 May 2005 13:57:15 -0000 1.73 +++ weather.pl 7 May 2005 15:35:52 -0000 1.74 @@ -30,20 +30,16 @@ # * Known stations searching. (%weather ny should be able to list # stations in NY. %weather massena, ny should get the weather for # KMSS) -# * Find a way to convert zip codes to lat/long, use to find closest -# station +# * use zip->lat/long to find closest station +# * find other postal codes -> lat/long databases so we can find the closest +# station outside the US # * KILL Geo::METAR DAMN IT -# * Forecasts would be nice. http://www.nws.noaa.gov/forecasts/xml/ -# * Fix crash if simbot quits before station name cache is updated -# (don't try to update DB if it's closed) package SimBot::plugin::weather; use strict; use warnings; -use Data::Dumper; - # The weather, more or less! use Geo::METAR; @@ -730,7 +726,7 @@ sub got_alerts { "$nick: " . &get_forecast($nick, $lat, $long)); return; } - my $raw_xml = $response->content; + my $raw_xml = $response->decoded_content; my $cap_alert; @@ -912,8 +908,6 @@ sub new_get_wx { . ' WHERE zip = ? LIMIT 1'); $get_lat_long_query->execute($args[0]); if(($lat, $long, $state, $geocode) = $get_lat_long_query->fetchrow_array) { - #&get_forecast($nick, $channel, $lat, $long); - #&get_alerts($kernel, $nick, $channel, $lat, $long, $state, $geocode); $kernel->post($session => 'get_alerts', $nick, $lat, $long, $state, $geocode); } else { &SimBot::send_message($channel, "$nick: I do not know where that zip code is."); @@ -943,6 +937,7 @@ sub get_alerts { my $url = 'http://weather.gov/alerts/' . lc($state) . '.cap'; my $request = HTTP::Request->new(GET => $url); + $request->header('Accept-Encoding' => 'gzip, deflate'); $kernel->post('wxua' => 'request', 'got_alerts', $request, "$nick!$lat!$long!$geocode"); |