Skip to content

Commit

Permalink
Merge pull request #8 from waynieack/json_server_wg
Browse files Browse the repository at this point in the history
Json server merge
  • Loading branch information
Wayne Gatlin authored Dec 16, 2016
2 parents 434f446 + 095c9eb commit c6201df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions lib/json_server.pl
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

=head1 B<json_server>
=head2 SYNOPSIS
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/site/Geo/WeatherNOAA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit c6201df

Please sign in to comment.