Ticket #4226: 4226_diff.2.patch

File 4226_diff.2.patch, 2.6 KB (added by Joe Ripley <vitaminjoe@…>, 16 years ago)

Revised original patch to remove unneeded line 35 from ENVCANParser.pm

  • mythplugins/mythweather/mythweather/scripts/envcan.pl

     
    148148        }
    149149        }
    150150} else {
    151         $results{'wind_spdgst'} = sprintf("%.2f (%.2f) kph", $results{'wind_speed'}, $results{'wind_gust'});
     151        $results{'wind_spdgst'} = sprintf("%.2f (%.2f)", $results{'wind_speed'}, $results{'wind_gust'});
    152152}
    153153       
    154154
  • mythplugins/mythweather/mythweather/scripts/ENVCANParser.pm

     
    33# This script parses the HTML of an Environment Canada weather forecast
    44# page as returned from http://www.weatheroffice.gc.ca.
    55#
    6 # TODO  Not exactly sure how Environment Canada reports windchill.  Looks
    7 #               like they don't report it in the summer time.  Using temperature
    8 #               as a value for now.
    9 #
    106# TODO  Environment Canada only reports 5 day forecasts.  6 day forecast
    117#               layout is used to report 5 day information.
    128#
     
    9793                        $results{'observation_time_rfc822'} = rfc822($1);
    9894                }
    9995        }
    100                
     96
    10197        if ($inside{dt}) {
    10298                if ($_[0] =~ /(Temperature)/) { $scratch = 1; return; }
    10399                if ($_[0] =~ /(Pressure)\/ Tendency/) { $scratch = 2; return; }
    104100                if ($_[0] =~ /(Visibility)/) { $scratch = 3; return; }
    105101                if ($_[0] =~ /(Humidity)/) { $scratch = 4; return; }
    106102                if ($_[0] =~ /(Dewpoint)/) { $scratch = 5; return; }
    107                 if ($_[0] =~ /(Wind)/) { $scratch = 6; return; }
     103                if ($_[0] =~ /(Wind Chill)/ ) { $scratch = 6; return; }
     104                if ($_[0] =~ /(Wind)/) { $scratch = 7; return; }
    108105        }
    109                
     106
    110107        if ($inside{dd}) {
    111                 if ($scratch == 1) { $_[0] =~ /(\d*).*/; $results{'temp'} = $1; $results{'windchill'} = $1; $results{'appt'} = $1; }
     108                if ($scratch == 1) { $_[0] =~ /(-?\d*).*/; $results{'temp'} = $1; }
    112109                if ($scratch == 2) { $_[0] =~ /(\d*\.\d+) kPa.*/; $results{'pressure'} = $1 * 10; }
    113110                if ($scratch == 3) { $_[0] =~ /(\d*) km/; $results{'visibility'} = $1; }
    114111                if ($scratch == 4) { $_[0] =~ /(\d*) \%/; $results{'relative_humidity'} = $1; }
    115112                if ($scratch == 5) { $_[0] =~ /(-?\d*).*/; $results{'dewpoint'} = $1; }
    116                 if ($scratch == 6) {
     113                if ($scratch == 6) { $_[0] =~ /(-?\d*).*/; $results{'appt'} = $1; $results{'windchill'} = $1; }
     114                if ($scratch == 7) {
    117115                        $_[0] =~ /.?(\w+) (\d+) km\/h/;
    118116                        $results{'wind_dir'} = $directions{$1};
    119117                        $results{'wind_speed'} = $2;