Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as text by krosaf ( 17 years ago )
proc ::weather::update { sid } {
  session import
  if { $Event eq "CmdPass" } {
    reply upd.try
    http run "http://gen.gismeteo.ru/frcdb/cityinfr.txt" -return -charset "cp866"
  }
  if { $HttpStatus < 0 } {
    reply -err upd.http
  }
  set datalist [list]
  foreach_ [split $HttpData "
"] {
    set_ [string trim $_]
    if { $_ eq "" } continue
    if { ![regexp {^[0-9-]+s+(d{5})s+[0-9-]+s+[0-9-]+s+(.+)$} $_ - n g] } {
      reply -err upd.pars
    }
    lappend datalist [list $g $n]
  }
  reply upd.done [llength $datalist]
  datafile putlist weather.citys $datalist
}

 

Revise this Paste

Your Name: Code Language: