Permalink
Browse files

Change ENVCAN parser to use ° rather than \260

Fixes #9657

Seems Environment Canada changed their data format for reporting temperatures.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information...
1 parent b584b68 commit c68c7aed28d2c4e382bc1f36a6cf66d59ca4a2e7 Joe Ripley committed with Beirdo Mar 11, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 mythplugins/mythweather/mythweather/scripts/ca_envcan/ENVCANParser.pm
@@ -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",
@@ -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)
@@ -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;

0 comments on commit c68c7ae

Please sign in to comment.