#2 screwed up the temperature readout, and #3 was already set to "F"Stan wrote:1) Download http://ereader.kiczek.com/incith-weather.tcl
2) Change the "F" on line 942 to "C"
3) Change "C" on line 973 to "F"
4) Change line 1036 to read: regexp -- {data-variable="condition"><span class="wx-value">(.*?)</span>} $html - output(conditions)
Regarding this, I figured out that the script is misreading the temperatures that are Celsius as Fahrenheitbpinard wrote:#2 screwed up the temperature readout, and #3 was already set to "F"Stan wrote:1) Download http://ereader.kiczek.com/incith-weather.tcl
2) Change the "F" on line 942 to "C"
3) Change "C" on line 973 to "F"
4) Change line 1036 to read: regexp -- {data-variable="condition"><span class="wx-value">(.*?)</span>} $html - output(conditions)
#4 fixed the condition output
Thanks for contributing
So I modified the code to be as below:[14:25:46] incith:weather-2.9d: <CP1832/#chat> !weather New York city
[14:25:49] got temperature 24.9 F
Code: Select all
# TEMPERATURE
if {[regexp -nocase {data-variable="temperature">} $html]} {
regexp -nocase {"temperature": (.*?),} $html - temp
regexp -nocase {"°(.*?)"} $html - deg
putlog "got temperature $temp $deg"
if {[string match "*F*" $deg)]} {
set output(tempc) $temp
set output(tempf) [format "%.${incith::weather::granularity}f" [expr {9.0/5.0*$output(tempc) + 32.0}]]
if {[string match *\.* $output(tempf)]} {
set c [split $output(tempf) .]
set ot1 [lindex $c 0]
set ot2 [string trim [lindex $c 1] " 0"]
if {[string length $ot2]} { set output(tempf) "${ot1}.${ot2}" } { set output(tempf) $ot1 }
}
} else {
set output(tempf) $temp
set output(tempc) [format "%.${incith::weather::granularity}f" [expr {5.0/9.0*($output(tempf) - 32.0)}]]
if {[string match *\.* $output(tempc)]} {
set c [split $output(tempc) .]
set ot1 [lindex $c 0]
set ot2 [string trim [lindex $c 1] " 0"]
if {[string length $ot2]} { set output(tempc) "${ot1}.${ot2}" } { set output(tempc) $ot1 }
}
}
}
if {[info exists output(tempf)]} {
set templength [string length $output(tempf)]
if {$templength > 20} {
putlog "length fubar"
set output(error) "Something is fubar! :)"
return [array get output]
}
}
# FEELS LIKE
if {[regexp -- {"feelslike": (.*?),} $html - feels]} {
if {[string match "*F*" $deg)]} {
set output(windchillc) $feels
set output(windchillf) [format "%.${incith::weather::granularity}f" [expr {9.0/5.0*$output(windchillc) + 32.0}]]
if {[string match *\.* $output(windchillf)]} {
set c [split $output(windchillf) .]
set ot1 [lindex $c 0]
set ot2 [string trim [lindex $c 1] " 0"]
if {[string length $ot2]} { set output(windchillf) "${ot1}.${ot2}" } { set output(windchillf) $ot1 }
}
} else {
set output(windchillf) $feels
set output(windchillc) [format "%.${incith::weather::granularity}f" [expr {5.0/9.0*($output(windchillf) - 32.0)}]]
if {[string match *\.* $output(windchillc)]} {
set c [split $output(windchillc) .]
set ot1 [lindex $c 0]
set ot2 [string trim [lindex $c 1] " 0"]
if {[string length $ot2]} { set output(windchillc) "${ot1}.${ot2}" } { set output(windchillc) $ot1 }
}
}
}
(2015-07-15 14:25:53) BOT: New York, New York (40.75013351/-73.99700928); Updated: 15 seconds ago; Conditions: cld; Temperature: 76.8°F (24.9°C); Feels like: 78.8°F (26°C); High/Low: Unavailable; UV: 1.0/12; Humidity: 83%; Wind: East
Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin ... ast?query=" to "http://www.wunderground.com/cgi-bin/fin ... ast?query=" and now the script works again.shadrach wrote:All requests now returning 'Please refine your search.'
Thanks. I did notice the modified url in the source but i was under the apprehension that script now used the mobile url which is unchanged so I assumed the problem was elsewhere.CP1832 wrote:Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin ... ast?query=" to "http://www.wunderground.com/cgi-bin/fin ... ast?query=" and now the script works again.shadrach wrote:All requests now returning 'Please refine your search.'
Worked great - thanks man!CP1832 wrote:Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin ... ast?query=" to "http://www.wunderground.com/cgi-bin/fin ... ast?query=" and now the script works again.shadrach wrote:All requests now returning 'Please refine your search.'
Thank you for the fix, that worked.CP1832 wrote:Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin ... ast?query=" to "http://www.wunderground.com/cgi-bin/fin ... ast?query=" and now the script works again.shadrach wrote:All requests now returning 'Please refine your search.'