| View previous topic :: View next topic |
| Author |
Message |
Hellster Voice
Joined: 10 Aug 2006 Posts: 22
|
Posted: Fri May 29, 2015 7:00 am Post subject: |
|
|
Many thanks speechles for keeping this script going, if you are coding it, or know who is, please pass along our thanks for keeping it going
PS: just tested it out
Unfortunately not working for me
[8:39pm] <N3W-B0T1> [13:09:36] got temperature 12.9 F
[8:39pm] <N3W-B0T1> [13:09:42] Tcl error [incith::weather::weather_handler]: invalid command name "clock"
I get that in console/partyline and no output to the channel at all  |
|
| Back to top |
|
 |
Mysticales Voice
Joined: 18 Oct 2011 Posts: 26
|
Posted: Sun May 31, 2015 9:47 am Post subject: |
|
|
Logged in to say thanks for the update. =) My Channel uses this feature quite a bit. Now I just have to make it less spammy on its output. ^^ hehe.
Is the sky and fc something that may be worked on still? Never used it before, but looks like something that could be nice. =) _________________ ~Battlez-avec la Mystique?~ |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Sat Jun 06, 2015 2:09 am Post subject: |
|
|
3 day forecast (!fc) appears to be functioning again  |
|
| Back to top |
|
 |
rjpearce Voice
Joined: 27 Mar 2006 Posts: 5
|
Posted: Sat Jun 13, 2015 8:00 pm Post subject: |
|
|
I don't know if this helps but I tried to do some debugging.
I wanted to see if the regex's on line 937 onwards were correct.
(line 937 onwards - focusing entirely on temperature only):
if {[regexp -nocase {data-variable="temperature">} $html]} {
regexp -nocase {"temperature": (.*?),} $html - temp
regexp -nocase {"°(.*?)"} $html - deg
if {[string match "*F*" $deg)]} {
I modified the script to output the entire html to a file.
Using Helsinki, Finland as the test location somewhere inside the giant html
content was the following:
<span class="wx-data" data-station="EFHK" data-variable="temperature"><span class="wx-value">16</span><span class="wx-unit">°C</span></span>
I tried playing around with the regexes but my tcl skills are beyond terrible and I couldn't validate any of them.
Do you think the spans would interfere with the collection of the temperature and unit ? |
|
| Back to top |
|
 |
khalidxpert Voice
Joined: 26 Jan 2008 Posts: 18
|
Posted: Wed Jun 17, 2015 5:19 am Post subject: error |
|
|
hi there
I have installed
# incith:weather v2.8p #
# #
# retrieves weather and forecast data from www.wunderground.com #
# tested on Eggdrop v1.6.18 #
i have getting error
<@A-Guy-From-Heaven> !sky Lahore
<@Yasmin> Lahore, Pakistan Astronomy; Sunrise: Unavailable; Sunset: Unavailable
kinldy suugest
also i am not able to open the site mentioned here
pls. help |
|
| Back to top |
|
 |
SVD Voice
Joined: 13 Mar 2006 Posts: 9
|
Posted: Fri Jul 10, 2015 3:08 pm Post subject: |
|
|
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) |
|
| Back to top |
|
 |
bpinard Voice
Joined: 30 May 2015 Posts: 1
|
Posted: Sat Jul 11, 2015 11:06 pm Post subject: |
|
|
| 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) |
#2 screwed up the temperature readout, and #3 was already set to "F"
#4 fixed the condition output
Thanks for contributing  |
|
| Back to top |
|
 |
JJTX Voice
Joined: 05 May 2015 Posts: 10 Location: United States
|
Posted: Sun Jul 12, 2015 8:14 pm Post subject: |
|
|
Awesome to see this script being amended/changed/updated.
Very much appreciated!
( theres nothing else like it ) |
|
| Back to top |
|
 |
CP1832 Halfop
Joined: 09 Oct 2014 Posts: 68
|
Posted: Wed Jul 15, 2015 1:29 pm Post subject: |
|
|
| bpinard wrote: | | 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) |
#2 screwed up the temperature readout, and #3 was already set to "F"
#4 fixed the condition output
Thanks for contributing  | Regarding this, I figured out that the script is misreading the temperatures that are Celsius as Fahrenheit | Quote: | [14:25:46] incith:weather-2.9d: <CP1832/#chat> !weather New York city
[14:25:49] got temperature 24.9 F | So I modified the code to be as below: | Code: | # 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 }
}
}
} | And now the bot displays the temperatures just fine | Quote: | | (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 |
|
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Thu Aug 06, 2015 9:17 am Post subject: |
|
|
All requests now returning 'Please refine your search.'  |
|
| Back to top |
|
 |
CP1832 Halfop
Joined: 09 Oct 2014 Posts: 68
|
Posted: Thu Aug 06, 2015 10:20 am Post subject: |
|
|
| shadrach wrote: | All requests now returning 'Please refine your search.'  | Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin/findweather/getForecast?query=" to "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=" and now the script works again. |
|
| Back to top |
|
 |
khalidxpert Voice
Joined: 26 Jan 2008 Posts: 18
|
Posted: Fri Aug 07, 2015 8:07 am Post subject: 1) Download http://ereader.kiczek.com/incith-weather.tcl |
|
|
i have downloded this weather tcl
but its giving an error
<Khaleed> !weather Lahore
<Nikama> Please refine your search.
As per willy
It appears to be working.
Further, this is at the top of the script - perhaps this is useful info for you:
Code:
#---------------------------------------------------------------------#
# incith:weather v2.9c#
# #
but when i downloded i got this version
#---------------------------------------------------------------------#
# incith:weather v2.9d#
# #
kindly provide me the version v2.9.c
thx
Khalid |
|
| Back to top |
|
 |
shadrach Halfop
Joined: 14 Dec 2007 Posts: 74
|
Posted: Fri Aug 07, 2015 11:58 am Post subject: |
|
|
| CP1832 wrote: | | shadrach wrote: | All requests now returning 'Please refine your search.'  | Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin/findweather/getForecast?query=" to "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=" and now the script works again. |
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.  |
|
| Back to top |
|
 |
webmastir Voice
Joined: 28 Jan 2011 Posts: 6
|
Posted: Fri Aug 07, 2015 10:03 pm Post subject: |
|
|
| CP1832 wrote: | | shadrach wrote: | All requests now returning 'Please refine your search.'  | Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin/findweather/getForecast?query=" to "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=" and now the script works again. |
Worked great - thanks man! |
|
| Back to top |
|
 |
simboy1234 Voice
Joined: 16 May 2015 Posts: 5
|
Posted: Sat Aug 08, 2015 5:39 am Post subject: |
|
|
| CP1832 wrote: | | shadrach wrote: | All requests now returning 'Please refine your search.'  | Yes, that happened to me as well. I replaced "http://classic.wunderground.com/cgi-bin/findweather/getForecast?query=" to "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=" and now the script works again. |
Thank you for the fix, that worked. |
|
| Back to top |
|
 |
|