From a496a9c1cc3d9ea337b4a93c72352f5447bbef53 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Wed, 1 Jan 2014 15:56:45 -0500 Subject: [PATCH] Don't duplicate completely equivalent weather alerts. --- conky-mythtv-weather-alert.plx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conky-mythtv-weather-alert.plx b/conky-mythtv-weather-alert.plx index 0ff03f8..46dd8da 100755 --- a/conky-mythtv-weather-alert.plx +++ b/conky-mythtv-weather-alert.plx @@ -101,6 +101,7 @@ foreach my $location (@ARGV) { my $output = ""; my $record = ""; my $info = ReadRecentWeatherAlerts($DIR); +my %equivalentLines; foreach my $location (keys %data) { die "Missing $location!" if (not defined $data{$location}{alerts}); next if $data{$location}{alerts} =~ /no\s*warning/i; @@ -119,6 +120,8 @@ foreach my $location (keys %data) { $ago = $data{$location}{updatetime}; } my $data = $data{$location}{alerts}; + next if defined $equivalentLines{$data}; + $equivalentLines{$data} = 1; my $conkyOut = autoformat( "\${font :size=10}For $data{$location}{swlocation}, as of $ago ago:\n$data", { justify => 'left', fill => 1, right => 60 });