Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json server merge #8

Merged
merged 5 commits into from
Dec 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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