Skip to content

Commit

Permalink
Change ENVCAN parser to use ° rather than \260
Browse files Browse the repository at this point in the history
Fixes #9657

Seems Environment Canada changed their data format for reporting temperatures.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
(cherry picked from commit c68c7ae)
  • Loading branch information
Joe Ripley authored and Beirdo committed Mar 11, 2011
1 parent 13be9c2 commit 40fc454
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -11,7 +11,7 @@ use strict;
use POSIX;
use XML::Simple;

our $VERSION = 0.4;
our $VERSION = 0.5;

my %results;
my %directions = ( N => "North", NNE => "North Northeast",
Expand Down Expand Up @@ -93,7 +93,7 @@ sub doParse {
$results{'weather_icon'} = getIcon($1);
}
$results{'temp'} = sprintf("%.0f", $1)
if ($item->{description} =~ /Temperature:\<\/b\>\s*(-?\d*\.?\d*)\260\C\s*\<br\/\>/s);
if ($item->{description} =~ /Temperature:\<\/b\>\s*(-?\d*\.?\d*)\&deg\;\C\s*\<br\/\>/s);
$results{'pressure'} = sprintf("%d", $1 * 10)
if ($item->{description} =~ /Pressure \/ Tendency:\<\/b\>\s*(\d*\.?\d*) kPa\s*.*\<br\/\>/s);
$results{'visibility'} = sprintf("%.1f", $1)
Expand All @@ -105,7 +105,7 @@ sub doParse {
$results{'windchill'} = $1;
}
$results{'dewpoint'} = sprintf("%.0f", $1)
if ($item->{description} =~ /Dewpoint:\<\/b\>\s*(-?\d*\.?\d*)\260\C\s*\<br\/\>/s);
if ($item->{description} =~ /Dewpoint:\<\/b\>\s*(-?\d*\.?\d*)\&deg\;\C\s*\<br\/\>/s);
if ($item->{description} =~ /(\d*\:\d*[\w ]*\d*[\w *]\d*)\s*\<br\/\>/s) {
$results{'observation_time'} = "Last updated at ". $1;
$results{'updatetime'} = "Last updated at ". $1;
Expand Down

0 comments on commit 40fc454

Please sign in to comment.