Don't duplicate completely equivalent weather alerts.
This commit is contained in:
parent
c6c9f7095c
commit
a496a9c1cc
1 changed files with 3 additions and 0 deletions
|
@ -101,6 +101,7 @@ foreach my $location (@ARGV) {
|
||||||
my $output = "";
|
my $output = "";
|
||||||
my $record = "";
|
my $record = "";
|
||||||
my $info = ReadRecentWeatherAlerts($DIR);
|
my $info = ReadRecentWeatherAlerts($DIR);
|
||||||
|
my %equivalentLines;
|
||||||
foreach my $location (keys %data) {
|
foreach my $location (keys %data) {
|
||||||
die "Missing $location!" if (not defined $data{$location}{alerts});
|
die "Missing $location!" if (not defined $data{$location}{alerts});
|
||||||
next if $data{$location}{alerts} =~ /no\s*warning/i;
|
next if $data{$location}{alerts} =~ /no\s*warning/i;
|
||||||
|
@ -119,6 +120,8 @@ foreach my $location (keys %data) {
|
||||||
$ago = $data{$location}{updatetime};
|
$ago = $data{$location}{updatetime};
|
||||||
}
|
}
|
||||||
my $data = $data{$location}{alerts};
|
my $data = $data{$location}{alerts};
|
||||||
|
next if defined $equivalentLines{$data};
|
||||||
|
$equivalentLines{$data} = 1;
|
||||||
my $conkyOut = autoformat(
|
my $conkyOut = autoformat(
|
||||||
"\${font :size=10}For $data{$location}{swlocation}, as of $ago ago:\n$data",
|
"\${font :size=10}For $data{$location}{swlocation}, as of $ago ago:\n$data",
|
||||||
{ justify => 'left', fill => 1, right => 60 });
|
{ justify => 'left', fill => 1, right => 60 });
|
||||||
|
|
Loading…
Add table
Reference in a new issue