changeset 201:92f4a489b7ef

Add data type index.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 18 Jun 2014 20:46:15 +0300
parents bfa9bbcad2e5
children 9b47f6d6c8bb 28ee3578a6d1
files fetch_weather.pl weather.tcl
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_weather.pl	Wed Jun 18 20:31:32 2014 +0300
+++ b/fetch_weather.pl	Wed Jun 18 20:46:15 2014 +0300
@@ -383,6 +383,7 @@
         my $fdata = @$oelems[$n]->{"nodes"};
         $weatherdata->{$fdata->[0]{"nodes"}[0]{"text"}} =
         [
+          0,
           parse_timestamp(get_node($fdata, "text", 1), $time_base),
           get_node($fdata, "text", 2),
           get_node($fdata, "text", 3),
@@ -454,6 +455,8 @@
           if ($flol->{"lat"} == $flat && $flol->{"long"} == $flong)
           {
             $weatherdata->{$floc->{"gml:name"}} =
+            [
+              1,
               $flol->{"time"},
               $flol->{"temp"},
               "",
--- a/weather.tcl	Wed Jun 18 20:31:32 2014 +0300
+++ b/weather.tcl	Wed Jun 18 20:46:15 2014 +0300
@@ -196,10 +196,10 @@
 
 # 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 1]]: \002[lindex $udata 2]°C\002"
-  append str [weather_item $udata 4 ", @@"]
-  append str [weather_item $udata 5 ", kosteus \002@@%\002"]
-  append str [weather_item $udata 3 ", tien pinta @@°C"]
+  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 4 ", tien pinta @@°C"]
   return "${str}."
 }
 
@@ -231,7 +231,7 @@
       gets $ufile uline
       set udata [split $uline "|"]
       if {[llength $udata] > 0} {
-        set utemp [lindex $udata 2]
+        set utemp [lindex $udata 3]
         set ukey [lindex $udata 0]
 
         set weather_data($ukey) $udata