# HG changeset patch # User Matti Hamalainen # Date 1401789885 -10800 # Node ID bbab8c79dd95ba7c73e8f48144644a86e22d4df9 # Parent d94be9a1be6a7dded5eda009a64a714c47332398 Remove useless file. diff -r d94be9a1be6a -r bbab8c79dd95 hae_saatiedot.tcl --- a/hae_saatiedot.tcl Tue Jun 03 13:00:38 2014 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -#!/usr/bin/tclsh -# -# NOTICE! Change above path to correct tclsh binary path! -# -########################################################################## -# -# Improved weather data fetcher for Jedah's "saa.tcl" -# by Matti 'ccr' Hamalainen -# (C) Copyright 2009-2011 Tecnic Software productions (TNSP) -# -# This script is freely distributable under GNU GPL (version 2) license. -# -########################################################################## - -# Path and filename of the data file, MUST BE SAME as in "saa.tcl" -set datafile "/home/niinuska/bot/saa.data" - -# Use a HTTP proxy? (1 = yes, 0 = no) -set use_proxy 0 - -# HTTP proxy host address and port (only needed if use_proxy = 1) -set http_proxy_host "cache.inet.fi" -set http_proxy_port 800 - - -########################################################################## -package require http -::http::config -urlencoding iso8859-1 -useragent "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 9.5" -if {$use_proxy != 0} { - ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port -} - - -########################################################################## -proc fetch_uri {uurl} { - global ngot - if {[catch {set utoken [::http::geturl $uurl -binary true -timeout 5000]} uerrmsg]} { - puts "Error getting #$uurl: $uerrmsg" - return "" - } else { - incr ngot - set udata [::http::data $utoken] - ::http::cleanup $utoken - return $udata - } -} - -########################################################################## -set tmpfname "$datafile.tmp" -if {[catch {set savefile [open $tmpfname w 0600]} uerrmsg]} { - puts "Error opening $tmpfname: $uerrmsg" - return 1 -} - -# Haetaan 22 framea osoitteista -# http://www.tiehallinto.fi/alk/tiesaa/tiesaa_maak_1.html - -# http://www.tiehallinto.fi/alk/tiesaa/tiesaa_maak_22.html -# ja talletetaan kaikki samaan tiedostoon -set ngot 0 -for { set i 1 } { $i < 23 } { incr i } { - puts $savefile [fetch_uri "http://alk.tiehallinto.fi/alk/tiesaa/tiesaa_maak_$i.html"] -} - -#set paske [fetch_uri "http://www.wunderground.com/global/stations/56294.html"] - -close $savefile -if {$ngot > 5} { - if {[catch {file rename -force -- $tmpfname $datafile} uerrmsg]} { - puts "Error renaming $tmpfname to $datafile: $uerrmsg" - } -} -