This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

incith:weather (2.8p) (Dec. 18th, 2008)

Support & discussion of released scripts, and announcements of new releases.
Post Reply
H
Hellster
Voice
Posts: 22
Joined: Thu Aug 10, 2006 7:35 pm

Post by Hellster »

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 :(
M
Mysticales
Voice
Posts: 26
Joined: Tue Oct 18, 2011 5:33 pm

Post by Mysticales »

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?~
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

3 day forecast (!fc) appears to be functioning again :?
r
rjpearce
Voice
Posts: 5
Joined: Mon Mar 27, 2006 8:36 am

Post by rjpearce »

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 ?
k
khalidxpert
Voice
Posts: 18
Joined: Sat Jan 26, 2008 2:03 am

error

Post by khalidxpert »

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
S
SVD
Voice
Posts: 9
Joined: Mon Mar 13, 2006 6:52 pm

Post by SVD »

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)
b
bpinard
Voice
Posts: 1
Joined: Sat May 30, 2015 2:18 pm

Post by bpinard »

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 :)
J
JJTX
Voice
Posts: 10
Joined: Tue May 05, 2015 4:44 pm
Location: United States

Post by JJTX »

Awesome to see this script being amended/changed/updated.

Very much appreciated!

( theres nothing else like it )
C
CP1832
Halfop
Posts: 68
Joined: Thu Oct 09, 2014 4:03 pm

Post by CP1832 »

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
[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: 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 }
          }
        }
      }
And now the bot displays the temperatures just fine
(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
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

All requests now returning 'Please refine your search.' :cry:
C
CP1832
Halfop
Posts: 68
Joined: Thu Oct 09, 2014 4:03 pm

Post by CP1832 »

shadrach wrote:All requests now returning 'Please refine your search.' :cry:
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.
k
khalidxpert
Voice
Posts: 18
Joined: Sat Jan 26, 2008 2:03 am

1) Download http://ereader.kiczek.com/incith-weather.tcl

Post by khalidxpert »

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
s
shadrach
Halfop
Posts: 74
Joined: Fri Dec 14, 2007 6:29 pm

Post by shadrach »

CP1832 wrote:
shadrach wrote:All requests now returning 'Please refine your search.' :cry:
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.
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. :oops:
w
webmastir
Voice
Posts: 6
Joined: Fri Jan 28, 2011 12:25 am

Post by webmastir »

CP1832 wrote:
shadrach wrote:All requests now returning 'Please refine your search.' :cry:
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.
Worked great - thanks man!
s
simboy1234
Voice
Posts: 5
Joined: Sat May 16, 2015 2:06 pm

Post by simboy1234 »

CP1832 wrote:
shadrach wrote:All requests now returning 'Please refine your search.' :cry:
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.
Thank you for the fix, that worked.
Post Reply