[RELEASE] Weather Plus Addon

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
sector72 Offline
Junior Member
Posts: 9
Joined: Apr 2012
Reputation: 0
Post: #916
Looks like NOAA has made some more changes that breaks a few things. Here's is a patch against weatherplus v3.0.1 to get things working again (cumulative with the patch I posted on 6 may 2012...):

Code:
--- noaa.py.orig    2012-07-07 00:17:01.658625504 -0400
+++ noaa.py    2012-07-07 00:16:53.730804446 -0400
@@ -229,7 +229,7 @@
    pattern_current_heatindex = "<td><b>Heat Index</b>:</td>[^<]+<td align=[^>]+>(.+?)\&deg\;F"

    pattern_current_block = "<data type=\"current observations\">"
-    pattern_current_icon = "<icon-link>http://forecast.weather.gov/images/wtf/([^\d\s]+).jpg"
+    pattern_current_icon = "<icon-link>http://forecast.weather.gov/images/wtf/([^\d\s]+).png"
    pattern_current_temp = "<temperature type=\"apparent\"[^>]+>(.+?)</temperature>"
    pattern_current_dew = "<temperature type=\"dew point\"[^>]+>(.+?)</temperature>"
    pattern_current_humidity = "<humidity[^>]+>(.+?)</humidity>"
@@ -239,17 +239,18 @@
    pattern_current_pressure = "<pressure type=\"barometer\"[^>]+>(.+?)</pressure>"
    pattern_current_brief = "<weather-conditions weather-summary=\"([^\"]+)\"/>"

-    pattern_current_wind = "<td><b>Wind Speed</b>:</td>[^<]+<td align=[^>]+>(.+?)</td>"
+    pattern_current_wind   = "<li><span[^>]+>Wind Speed</span>(.+?)</li>"
    pattern_current_wind_2 = "<td><b>Wind Speed</b>:</td><td align=[^>]+>(.+?)<br>"
         pattern_precip_amount = "no-repeat;\">([0-9]+)\%</td><td class=\"weekly_wind\">"
-        pattern_outlook = ": </b>(.+?)<br><br>"
+    pattern_outlook_block = "class=\"point-forecast-7-day\"(.+?)</ul>"
+        pattern_outlook = "</span>(.+?)</li>"
    pattern_sunrise = "sunrise will occur around (.+?)am"
    pattern_sunset = "sunset will occur around (.+?)pm"
    pattern_wind = "<td class=\"weekly_wind\"><img class=\"wind\" src=\"image/(.+?).png\" width=\"50\" height=\"22\" alt=\"[^\"]+\" /><br />(.+?)</td>"
    pattern_xml_high_temp = "<value>(.[0-9]+)</value>"
    pattern_xml_brief = "<weather-conditions weather-summary=\"(.+?)\"/>"    
    pattern_xml_days = "<start-valid-time period-name=\"(.+?)\">"
-    pattern_icon = "<icon-link>(.+?).jpg</icon-link>"
+    pattern_icon = "<icon-link>(.+?).png</icon-link>"

    pattern_alerts = "showsigwx.php[?]([^\"]+)\"><[^>]+>([^<]+)<"

@@ -282,7 +283,7 @@
    current_icon = icondir.get( current_icon, "na" ) + ".png"
    for count in range(0, 13-ampm):
        icon += [ icondir.get ( re.findall( "([^\d\s]+)", icons[count].split("/")[-1] )[0], "na" ) ]
-    # printlog("NOAA icons : " + ",".join(icon))
+    #printlog("NOAA icons : " + ",".join(icon))

         # enumerate thru and combine the day with it's forecast
         if ( len( icon ) ):
@@ -348,7 +349,8 @@
             precip_amount = re.findall( pattern_precip_amount, htmlSource_2 )

             # fetch forecasts
-            outlook = re.findall( pattern_outlook, htmlSource )
+        outlook_block = re.findall( pattern_outlook_block, htmlSource, re.DOTALL )
+            outlook = re.findall( pattern_outlook, outlook_block[0] )

             # fetch extra info
        pressure = re.findall( pattern_current_pressure, current )[0]
@@ -377,10 +379,11 @@
             for count in range(0, 13):
                 # make icon path
                 try :
-                  iconpath = "/".join( [ "special://temp", "weather", "128x128", icon[ count ] + ".png" ] )
+          printlog( "ICON " + str(count) + ": " + icon[count] + ".png" )
+                  iconpath = "/".join( [ "special://temp", "weather", icon[ count ] + ".png" ] )
                 except :
                   printlog("Icon is not available")
-                  iconpath = "/".join( [ "special://temp", "weather", "128x128", "na.png" ] )
+                  iconpath = "/".join( [ "special://temp", "weather", "na.png" ] )
        # printlog( iconpath )
                 # date calculation for 6 day
        year = time.strftime( "%Y", time.localtime() )
@@ -618,36 +621,39 @@
            else:
                outlook = "Rain Likely"
            icon += "rain"
-        elif ( snow[count] != "--" ):
-            if ( rain[count] == "SChc" ):
-                outlook = "Slight Chace of Snow"
-                icon += "chance"
-            elif ( rain[count] == "Chc" ):
-                outlook = "Chance of Snow"
-                icon += "chance"
-            else:
-                outlook = "Snow Likely"
-            icon += "snow"
-        elif ( freezing_rain[count] != "--" ):
-            if ( rain[count] == "SChc" ):
-                outlook = "Slight Chace of Freezing Rain"
-                icon += "chance"
-            elif ( rain[count] == "Chc" ):
-                outlook = "Chance of Freezing Rain"
-                icon += "chance"
-            else:
-                outlook = "Freezing Rain Likely"
-            icon += "freeze"
-        elif ( sleet[count] != "--" ):
-            if ( rain[count] == "SChc" ):
-                outlook = "Slight Chace of Sleet"
-                icon += "chance"
-            elif ( rain[count] == "Chc" ):
-                outlook = "Chance of Sleet"
-                icon += "chance"
-            else:
-                outlook = "Sleet Likely"            
-            icon += "sleet"        
+        elif ( snow ):
+            if ( snow[count] != "--" ):
+                if ( rain[count] == "SChc" ):
+                    outlook = "Slight Chace of Snow"
+                    icon += "chance"
+                elif ( rain[count] == "Chc" ):
+                    outlook = "Chance of Snow"
+                    icon += "chance"
+                else:
+                    outlook = "Snow Likely"
+                icon += "snow"
+        elif ( freezing_rain ):
+            if ( freezing_rain[count] != "--" ):
+                if ( rain[count] == "SChc" ):
+                    outlook = "Slight Chace of Freezing Rain"
+                    icon += "chance"
+                elif ( rain[count] == "Chc" ):
+                    outlook = "Chance of Freezing Rain"
+                    icon += "chance"
+                else:
+                    outlook = "Freezing Rain Likely"
+                icon += "freeze"
+        elif ( sleet ):
+            if ( sleet[count] != "--" ):
+                if ( rain[count] == "SChc" ):
+                    outlook = "Slight Chace of Sleet"
+                    icon += "chance"
+                elif ( rain[count] == "Chc" ):
+                    outlook = "Chance of Sleet"
+                    icon += "chance"
+                else:
+                    outlook = "Sleet Likely"            
+                icon += "sleet"        
        elif ( int(wind[count]) > 20 ):
            icon = "windy"
            outlook = "Windy"
@@ -670,4 +676,4 @@
            icon += "cloudy"
            outlook = "Cloudy"
        hour_temp += 1
-        self.forecast += [ ( _localize_unit( hour, "time" ), dates[ count ], "special://temp/weather/128x128/%s.png" % icondir.get(icon, "na"), _localize_unit(temperature[ count ]), outlook, _english_localize_unit( feelslike ), precip[ count ], humidity[ count ], windir.get( wind_direction[ count ] ), _localize_unit( wind[ count ]+" mph", "speed" ), "" ) ]        
+        self.forecast += [ ( _localize_unit( hour, "time" ), dates[ count ], "special://temp/weather/%s.png" % icondir.get(icon, "na"), _localize_unit(temperature[ count ]), outlook, _english_localize_unit( feelslike ), precip[ count ], humidity[ count ], windir.get( wind_direction[ count ] ), _localize_unit( wind[ count ]+" mph", "speed" ), "" ) ]

There's still some weirdness with a missing icon or two that I haven't yet fixed (mostly because I haven't bothered trying to understand how NOAA icons get mapped to XBMC icons) but this patch should be sufficient to stop the script failure messages when using NOAA as the weather source...
find quote
sector72 Offline
Junior Member
Posts: 9
Joined: Apr 2012
Reputation: 0
Post: #917
Another small patch for the NOAA stuff. This one fixes alert-fetching and the current condition icon. Diff was generated against the patched noaa.py from my July 7 post so you'll need to apply that patch first...

Code:
--- noaa.py.jrm2    2012-07-09 23:05:37.753203712 -0400
+++ noaa.py    2012-07-09 23:57:03.228370708 -0400
@@ -252,7 +252,7 @@
    pattern_xml_days = "<start-valid-time period-name=\"(.+?)\">"
    pattern_icon = "<icon-link>(.+?).png</icon-link>"

-    pattern_alerts = "showsigwx.php[?]([^\"]+)\"><[^>]+>([^<]+)<"
+    pattern_alerts = "showsigwx.php[?]([^\"]+)\">([^<]+)<"

    # fetch alerts
    self.alerts = re.findall( pattern_alerts, htmlSource )
@@ -280,7 +280,7 @@
    # fetch icons
    icon = []
    icons = re.findall( pattern_icon, xmlSource )
-    current_icon = icondir.get( current_icon, "na" ) + ".png"
+    current_icon = icondir.get( current_icon.split("/")[-1], "na" ) + ".png"
    for count in range(0, 13-ampm):
        icon += [ icondir.get ( re.findall( "([^\d\s]+)", icons[count].split("/")[-1] )[0], "na" ) ]
    #printlog("NOAA icons : " + ",".join(icon))
find quote
vijayk416 Offline
Senior Member
Posts: 198
Joined: Apr 2011
Reputation: 1
Post: #918
Can someone please post an update to the repo that incorporates these patches? Manual patching is not for me and I imagine not for a lot of folks who would like to make use of this fine add-on.
find quote
codex70 Offline
Junior Member
Posts: 48
Joined: Feb 2011
Reputation: 0
Post: #919
(2011-12-27 04:11)ronie Wrote:  
pkscuot Wrote:wunderground isn't available as a source in Weather+ any longer. Apparently when the XBMC folks stuck the deal with Weather Underground to do the weather feed for XBMC Eden it apparently precluded any other plugin provider from using Weather Underground as a data source.

i hope you don't mind if i step in for a sec to correct this piece of information.

wundeground has provided xbmc free access to their api and this is a gesture team xbmc appreciates very much.
you can read all about it here:
http://xbmc.org/theuni/2011/12/10/welcom...derground/

the problem we had with weatherplus was the fact that it was scraping the wunderground website.

it's like, someone trusts you with the key to their front-door and we would allow someone else to throw in the window to get inside at the same time.
that just didn't feel right to us.

i have discussed our concern about this with brightsr in PM and we have agreed to work together on a way to give weatherplus access to the wunderground weather data.

it's something (besides a dozen of other things) i'm currently working on.
i have it partially working already locally, so if all goes well, weatherplus users should be able to select wunderground as their service provider again in the near future.

Is there any news on this? I love the extra functionality weather plus gives, but currently it doesn't work at all in the UK. If we could use the wunderground data then that would be perfect.
find quote
ronie Offline
Team-Kodi Member
Posts: 9,153
Joined: Jan 2009
Reputation: 157
Post: #920
(2012-09-11 10:30)codex70 Wrote:  
(2011-12-27 04:11)ronie Wrote:  
pkscuot Wrote:wunderground isn't available as a source in Weather+ any longer. Apparently when the XBMC folks stuck the deal with Weather Underground to do the weather feed for XBMC Eden it apparently precluded any other plugin provider from using Weather Underground as a data source.

i hope you don't mind if i step in for a sec to correct this piece of information.

wundeground has provided xbmc free access to their api and this is a gesture team xbmc appreciates very much.
you can read all about it here:
http://xbmc.org/theuni/2011/12/10/welcom...derground/

the problem we had with weatherplus was the fact that it was scraping the wunderground website.

it's like, someone trusts you with the key to their front-door and we would allow someone else to throw in the window to get inside at the same time.
that just didn't feel right to us.

i have discussed our concern about this with brightsr in PM and we have agreed to work together on a way to give weatherplus access to the wunderground weather data.

it's something (besides a dozen of other things) i'm currently working on.
i have it partially working already locally, so if all goes well, weatherplus users should be able to select wunderground as their service provider again in the near future.

Is there any news on this? I love the extra functionality weather plus gives, but currently it doesn't work at all in the UK. If we could use the wunderground data then that would be perfect.

well yes, as promised above, i've added a module to the wunderground addon that can be used by other addons to fetch weather data from the wunderground api.

if anyone wishes to use it, shoot me a PM and i'll help you out

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
codex70 Offline
Junior Member
Posts: 48
Joined: Feb 2011
Reputation: 0
Post: #921
Ronie, did try sending a message, but don't know whether you got it. If you've got any info I may be able to look into fixing this plugin. Would be good to get it working again.
find quote
ronie Offline
Team-Kodi Member
Posts: 9,153
Joined: Jan 2009
Reputation: 157
Post: #922
(2012-09-26 17:17)codex70 Wrote:  Ronie, did try sending a message, but don't know whether you got it. If you've got any info I may be able to look into fixing this plugin. Would be good to get it working again.

terribly sorry for the late reply...

get the latest development version here:
weather.wunderground-1.0.0.zip

and read the documentation in:
weather.wunderground/resources/lib/wunderground/wunderground.py

if you have any specific question, please ask them here:
http://forum.xbmc.org/showthread.php?tid=116668

Always read the Kodi online-manual, FAQ and search the forum before posting.
Do not PM or e-mail Team-Kodi members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
davidswanson1 Offline
Junior Member
Posts: 1
Joined: Nov 2012
Reputation: 0
Post: #923
Hi, I have a fresh install of XMBC on Windows 7 32 bit Service Pack1 Build 7601
XBMC Version 11.0 GIT:20120321-14FEB09

I enabled Weather Plus in Confusion Skin and also tried Ravier Skin.
All I get is 32Deg. I'm using Weather.com and I tried NOAA and Accuweather. Accuweather wont even find any city when I search.
When I click refresh it fetches no weather.
I've attached my XMBC log.
Any help you be greatly appreciated as I would like to use Weather Plus.
Thank you

EDIT: In-line posting of log removed by moderator. Please upload logs to http://www.pastebin.com or http://www.xbmclogs.com
(This post was last modified: 2012-11-16 06:55 by artrafael.)
find quote
artrafael Offline
Team-XBMC Forum Moderator
Posts: 6,353
Joined: Jul 2010
Reputation: 112
Location: USA
Post: #924
Welcome to the XBMC forums.

Please look at the posts on the previous page of this thread. This add-on is broken and no longer supported. Use the Weather Underground add-on instead.
find quote
Gingerbread Man Offline
Member
Posts: 60
Joined: Sep 2011
Reputation: 0
Post: #925
..
(This post was last modified: 2013-01-20 17:28 by Gingerbread Man.)
find quote
Post Reply