# HG changeset patch # User Matti Hamalainen # Date 1449866273 -7200 # Node ID de411e7834aaafde5eab11081e97e203507391ea # Parent a52a983c0c14c0fbfe9d6b8161938502bfebb5df fetch_weather: Reload old data from stored data. diff -r a52a983c0c14 -r de411e7834aa fetch_weather.pl --- a/fetch_weather.pl Fri Dec 11 22:19:21 2015 +0200 +++ b/fetch_weather.pl Fri Dec 11 22:37:53 2015 +0200 @@ -276,6 +276,27 @@ ### +### Load already cached data +### +if (opt_chk_valid("outfile", 1)) +{ + my $str = read_file(opt_get("outfile"), binmode => ':utf8', err_mode => 'quiet'); + if (defined($str)) + { + foreach my $line (split(/\s*\n\s*/, $str)) + { + my @mtmp = split(/\|/, $line); + if (scalar(\@mtmp) >= 4) + { + $weatherdata->{shift @mtmp} = \@mtmp; + } + } + print STDERR scalar(keys %$weatherdata)." old records reloaded.\n" if (opt_get_int("debug") > 0); + } +} + + +### ### Fetch Tiehallinto data ### if (opt_chk_bool("opt_tiehallinto"))