Correct details about figuring out if we have forecast data from first source
or not.
This commit is contained in:
parent
e63a51ed16
commit
7516706de1
1 changed files with 9 additions and 10 deletions
|
@ -85,8 +85,13 @@ foreach my $type (keys %commands) {
|
||||||
die "error($?) running: $commands{$type} -u $UNITS $LOCATION: $!"
|
die "error($?) running: $commands{$type} -u $UNITS $LOCATION: $!"
|
||||||
unless $? == 0;
|
unless $? == 0;
|
||||||
}
|
}
|
||||||
|
if (not defined $data{current}{observation_time}) {
|
||||||
if (not defined $data{forecast}{updatetime}) {
|
foreach my $key (%{$data{accuweather}}) {
|
||||||
|
$data{current}{$key} = $data{accuweather}{$key};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (not defined $data{forecast}{updatetime}
|
||||||
|
and defined $data{accuweather}{'time-1'}) {
|
||||||
foreach my $key (%{$data{accuweather}}) {
|
foreach my $key (%{$data{accuweather}}) {
|
||||||
$data{forecast}{$key} = $data{accuweather}{$key};
|
$data{forecast}{$key} = $data{accuweather}{$key};
|
||||||
}
|
}
|
||||||
|
@ -127,21 +132,15 @@ foreach my $ii (qw/0 1 2 3 4 5/) {
|
||||||
}
|
}
|
||||||
my $f = $FONT_SIZE + 5;
|
my $f = $FONT_SIZE + 5;
|
||||||
print '${voffset ', $VOFFSET_TEXT , '} ${font :size=', $f, '}${alignc}Weather:${font}', " $data{current}{'cclocation'}\n";
|
print '${voffset ', $VOFFSET_TEXT , '} ${font :size=', $f, '}${alignc}Weather:${font}', " $data{current}{'cclocation'}\n";
|
||||||
|
|
||||||
if (not defined $data{current}{observation_time}) {
|
|
||||||
foreach my $key (%{$data{accuweather}}) {
|
|
||||||
$data{current}{$key} = $data{accuweather}{$key};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (not defined $data{current}{observation_time_rfc822}) {
|
if (not defined $data{current}{observation_time_rfc822}) {
|
||||||
$data{current}{observation_time_rfc822} = $data{current}{observation_time};
|
$data{current}{observation_time_rfc822} = $data{current}{observation_time};
|
||||||
$data{current}{observation_time_rfc822} =~ s/^\s*(?:Observation\s*of\s*:?|Last\s*Updated\s*(?:on)?)\s*//;
|
$data{current}{observation_time_rfc822} =~ s/^\s*(?:Observation\s*of\s*:?|Last\s*Updated\s*(?:on)?)\s*//;
|
||||||
}
|
}
|
||||||
my($temp, $feelsLike, $humidity, $windSpeed, $windGust, $icon, $datetime) =
|
my($temp, $feelsLike, $humidity, $windSpeed, $windGust, $icon, $datetime, $weatherConditions) =
|
||||||
($data{current}{temp}, $data{current}{heat_index},
|
($data{current}{temp}, $data{current}{heat_index},
|
||||||
$data{current}{relative_humidity}, $data{current}{wind_speed},
|
$data{current}{relative_humidity}, $data{current}{wind_speed},
|
||||||
$data{current}{wind_gust}, $data{current}{weather_icon},
|
$data{current}{wind_gust}, $data{current}{weather_icon},
|
||||||
$data{current}{observation_time_rfc822});
|
$data{current}{observation_time_rfc822}, $data{current}{weather});
|
||||||
|
|
||||||
my $date = ParseDate($datetime);
|
my $date = ParseDate($datetime);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue