diff --git a/lib/json_server.pl b/lib/json_server.pl old mode 100644 new mode 100755 index b4cf561a1..0d3021290 --- a/lib/json_server.pl +++ b/lib/json_server.pl @@ -1,4 +1,3 @@ - =head1 B =head2 SYNOPSIS @@ -254,9 +253,16 @@ sub json_get { # RRD data routines if ( $path[0] eq 'rrd' || $path[0] eq '' ) { my $path = "$config_parms{data_dir}/rrd"; + $path = "$config_parms{rrd_dir}" + if ( defined $config_parms{rrd_dir} ); $path = $json_data{'rrd_config'}->{'prefs'}->{'path'} if ( defined $json_data{'rrd_config'}->{'prefs'}->{'path'} ); - my $rrd_file = "weather.rrd"; + my $rrd_file = "weather_data.rrd"; + $rrd_file = $config_parms{weather_data_rrd} + if ( defined $config_parms{weather_data_rrd} ); + if ( $rrd_file =~ m/.*\/(.*\.rrd)/ ) { + $rrd_file = $1; + } $rrd_file = $json_data{'rrd_config'}->{'prefs'}->{'default_rrd'} if ( defined $json_data{'rrd_config'}->{'prefs'}->{'default_rrd'} ); my $default_cf = "AVERAGE"; @@ -410,7 +416,7 @@ sub json_get { $data{'periods'} = $json_data{'rrd_config'}->{'periods'} if ( defined $json_data{'rrd_config'}->{'periods'} ); $data{'last_update'} = $xml_info->{'last_update'} * 1000 - if ( defined $xml_info->{'last_update'} ); + if ( ref($xml_info) eq 'HASH' && defined $xml_info->{'last_update'} ); $json_data{'rrd'} = \%data; } diff --git a/lib/site/Geo/WeatherNOAA.pm b/lib/site/Geo/WeatherNOAA.pm index e5ccd2c01..57d29170f 100644 --- a/lib/site/Geo/WeatherNOAA.pm +++ b/lib/site/Geo/WeatherNOAA.pm @@ -169,7 +169,7 @@ sub process_city_zone { foreach my $key ( keys %forecast ) { $forecast{$key} =~ tr/\012//d; # Remove newlines - #$forecast{$key} = lc($forecast{$key}); # No all CAPS + #$forecast{$key} = lc($forecast{$key}); # No all CAPS $forecast{$key} =~ s/\s+/ /g; # Rid of multi-spaces $forecast{$key} = sent_caps( $forecast{$key} ); # Proper sentance caps } @@ -580,7 +580,7 @@ sub get_city_hourly { #print STDERR "$line\n"; #'@0 A15 @15 A9 @24 A5 @29 A5 @34 A4 @39 A8 @47 A8 @55 A8', $line; - return {} if $values[3] eq 'NOT AVBL'; # Return ref to empty hash + return {} if $values[3] eq 'NOT AVBL'; # Return ref to empty hash my %retValue; foreach my $i ( 0 .. $#fields ) {