diff fetch_weather.pl @ 247:85ad2912e720

Possibly handle cloudyness translation better.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Jan 2015 20:43:06 +0200
parents 9435745b0dbb
children 19c64798de91
line wrap: on
line diff
--- a/fetch_weather.pl	Mon Jan 19 20:37:29 2015 +0200
+++ b/fetch_weather.pl	Mon Jan 19 20:43:06 2015 +0200
@@ -279,17 +279,23 @@
 my %th_cloud_states =
 (
   0 => "selkeää",
+  1 => "melkein selkeää",
+  2 => "verrattain selkeää",
+  3 => "verrattain selkeää",
+  4 => "puolipilvistä",
+  5 => "verrattain pilvistä",
+  6 => "verrattain pilvistä",
   7 => "melkein pilvistä",
   8 => "pilvistä",
 );
 
 sub translate_clouds($)
 {
-  my $tmp = $_[0];
-  return "" if ($tmp eq "NaN" || $tmp eq "");
+  return "" if ($_[0] eq "NaN" || $_[0] eq "");
+  my $tmp = int($_[0]);
   foreach my $n (sort { $a <=> $b } keys %th_cloud_states)
   {
-    return $th_cloud_states{$n} if ($tmp == $n);
+    return $th_cloud_states{$n}." (".$n."/8)" if ($tmp == $n);
   }
   return $tmp;
 }