diff weather.tcl @ 238:a1d6e2d8789e

Add new data from FMI service and change datafile format.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Jan 2015 16:26:42 +0200
parents dc1afa011883
children ae9d83ec50d5
line wrap: on
line diff
--- a/weather.tcl	Mon Jan 19 11:34:44 2015 +0200
+++ b/weather.tcl	Mon Jan 19 16:26:42 2015 +0200
@@ -207,10 +207,15 @@
 # Produce one location of weather data as a string
 proc weather_get_data {ukey udata} {
   set str "\002[lindex $udata 0]\002, mitattu klo [weather_ctime [lindex $udata 2]]: \002[lindex $udata 3]°C\002"
-  append str [weather_item $udata 5 ", @@"]
-  append str [weather_item $udata 6 ", kosteus \002@@%\002"]
-  append str [weather_item $udata 7 ", keli @@"]
-  append str [weather_item $udata 4 ", tien pinta @@°C"]
+  if {[lindex $udata 1] == 0} {
+    append str [weather_item $udata 4 ", @@"]
+    append str [weather_item $udata 5 ", keli @@"]
+    append str [weather_item $udata 6 ", tien pinta @@°C"]
+  } else {
+    append str [weather_item $udata 4 ", kosteus \002@@%\002"]
+    append str [weather_item $udata 5 ", tuuli \002@@\002 m/s"]
+    append str [weather_item $udata 6 ", pilvipeite \002@@\002"]
+  }
   return "${str}."
 }