From a3809de919e7d8e056542209c4520d6ab0ff669e Mon Sep 17 00:00:00 2001 From: Matthew Slowe Date: Tue, 4 Jun 2019 20:37:24 +0100 Subject: [PATCH] Previous updates --- new.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/new.pl b/new.pl index 572eb2e..48523d6 100755 --- a/new.pl +++ b/new.pl @@ -65,9 +65,14 @@ foreach my $station (@stations) { my $leveldata = from_json($1); $stationname = $stationdata->{'name'}; - $level = $leveldata->[0]->{_}; + # $level = $leveldata->[0]->{_}; + $res->content =~ m~Latest recorded level (-?[\d\.]+)m~; + $level = $1; # $res->content =~ m~Recorded at (.*)~; - $lastupdate = UnixDate($leveldata->[0]->{ts}, "%Y-%m-%dT%T.000Z"); + $res->content =~ m~Recorded at ([^<]+)<~; + my $lastupdate_str = $1; + $lastupdate = UnixDate($lastupdate_str, "%Y-%m-%dT%T.000Z"); + # $lastupdate = UnixDate($leveldata->[0]->{ts}, "%Y-%m-%dT%T.000Z"); print STDERR "[$station] $stationname is $level at $lastupdate\n" if $ENV{R_DEBUG}; if($ENV{R_GPLOT}) {