The branch, frodo has been updated
       via  9158099f57b28c1879ed1471a079fd31a3f7a944 (commit)
      from  0b746073215ce732f7d7d86c41f359b23d2491d8 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=9158099f57b28c1879ed1471a079fd31a3f7a944

commit 9158099f57b28c1879ed1471a079fd31a3f7a944
Author: Martijn Kaijser <[email protected]>
Date:   Thu Dec 19 08:45:42 2013 +0100

    [weather.ozweather] 0.6.7

diff --git a/weather.ozweather/addon.xml b/weather.ozweather/addon.xml
index e43b69f..2107deb 100644
--- a/weather.ozweather/addon.xml
+++ b/weather.ozweather/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="weather.ozweather" name="Oz Weather" version="0.6.6" 
provider-name="Bossanova808">
+<addon id="weather.ozweather" name="Oz Weather" version="0.6.7" 
provider-name="Bossanova808">
        <requires>
                <import addon="xbmc.python" version="2.1.0"/>
     <import addon="script.module.parsedom" version="1.2.0"/>
diff --git a/weather.ozweather/changelog.txt b/weather.ozweather/changelog.txt
index 4678fba..a2f89c5 100644
--- a/weather.ozweather/changelog.txt
+++ b/weather.ozweather/changelog.txt
@@ -1,3 +1,6 @@
+V0.6.7
+- Added sunrise/sunset, rain predictions to 7 day forecast
+
 V0.6.6
 - Use mathematical rounding instead of skin truncating
 
diff --git a/weather.ozweather/default.py b/weather.ozweather/default.py
index e1cc4aa..9357e72 100644
--- a/weather.ozweather/default.py
+++ b/weather.ozweather/default.py
@@ -22,6 +22,7 @@ import ftplib
 import shutil
 import time
 import datetime
+
 # Minimal code to import bossanova808 common code
 ADDON           = xbmcaddon.Addon()
 CWD             = ADDON.getAddonInfo('path')
@@ -159,10 +160,17 @@ def clearProperties():
         setProperty(WEATHER_WINDOW, 'Current.UVIndex')
         setProperty(WEATHER_WINDOW, 'Current.OutlookIcon')
         setProperty(WEATHER_WINDOW, 'Current.FanartCode')
+        setProperty(WEATHER_WINDOW, 'Current.Sunrise')
+        setProperty(WEATHER_WINDOW, 'Current.Sunset')
+        setProperty(WEATHER_WINDOW, 'Current.RainSince9')
+        setProperty(WEATHER_WINDOW, 'Current.RainLastHr')
+
 
         #and all the properties for the forecast
         for count in range(0,7):
-            setProperty(WEATHER_WINDOW, 'Day%i.Title'       % count)
+            setProperty(WEATHER_WINDOW, 'Day%i.Title'            % count)
+            setProperty(WEATHER_WINDOW, 'Day%i.RainChance'       % count)
+            setProperty(WEATHER_WINDOW, 'Day%i.RainChanceAmount' % count)
             setProperty(WEATHER_WINDOW, 'Day%i.HighTemp'    % count)
             setProperty(WEATHER_WINDOW, 'Day%i.LowTemp'     % count)
             setProperty(WEATHER_WINDOW, 'Day%i.Outlook'     % count)
@@ -451,12 +459,16 @@ def propertiesPDOM(page, extendedFeatures):
         ret = common.parseDOM(page, "div", attrs = { "class": "details_lhs" })
         observations = common.parseDOM(ret, "td", attrs = { "class": "hilite 
bg_yellow" })
         #Observations now looks like - ['18.3&deg;C', '4.7&deg;C', 
'18.3&deg;C', '41%', 'SSW 38km/h', '48km/h', '1015.7hPa', '-', '0.0mm / -']
-        log("Observations Retrieved: " + str(observations))
+        log("Current Conditions Retrieved: " + str(observations))
         temperature = str(int(round(float(observations[0].strip( '&deg;C' )))))
         dewPoint = str(int(round(float(observations[1].strip( '&deg;C' )))))
         feelsLike = str(int(round(float(observations[2].strip( '&deg;C' )))))  
      
         humidity = observations[3].strip( '%')
         windTemp = observations[4].partition(' ');
+        rainSince = observations[8].partition('/');
+        log("Rain Since: " + str(rainSince))        
+        rainSince9 = str(rainSince[0].strip())
+        rainLastHr = str(rainSince[2].strip())
         windDirection = windTemp[0]
         windSpeed = windTemp[2].strip( 'km/h')
         #there's no UV so we get that from the forecast, see below
@@ -467,6 +479,17 @@ def propertiesPDOM(page, extendedFeatures):
         setProperty(WEATHER_WINDOW, "Weather.IsFetched", "false")
     ####END CURRENT DATA
 
+    try:
+        #pull data from the atrological table
+        ret = common.parseDOM(page, "div", attrs = { "class": "details_rhs" })
+        observations = common.parseDOM(ret, "td", attrs = { "class": "hilite 
bg_yellow" })
+        log("Astrological Retrieved: " + str(observations))
+        sunrise = str(observations[0])
+        sunset = str(observations[1])
+    except:
+        log("********** OzWeather Couldn't Parse Astrological Data, sorry!!", 
inst)
+
+
     ####FORECAST DATA
     try:
         #pull the basic data from the forecast table
@@ -479,10 +502,14 @@ def propertiesPDOM(page, extendedFeatures):
         UV = UVtext[0] + ' (' + UVnumber[0] + ')'
         #get the 7 day max min forecasts
         maxMin = common.parseDOM(ret, "td")
+        #log( "maxmin is " + str(maxMin))
         #for count, element in enumerate(maxMin):
         #   print "********" , count , "^^^" , str(element)
-        maxList = stripList(maxMin[7:14],'&deg;C');
-        minList = stripList(maxMin[14:21],'&deg;C');
+        maxList = stripList(maxMin[7:14],'&deg;C')
+        minList = stripList(maxMin[14:21],'&deg;C')
+        rainChanceList = stripList(maxMin[21:28],'')
+        rainAmountList = stripList(maxMin[28:35],'')
+        log (str(rainChanceList) + str(rainAmountList))
         #and the short forecasts
         shortDesc = common.parseDOM(ret, "td", attrs = { "class": "bg_yellow" 
})
         shortDesc = common.parseDOM(ret, "span", attrs = { "style": 
"font-size: 0.9em;" })
@@ -566,6 +593,10 @@ def propertiesPDOM(page, extendedFeatures):
         setProperty(WEATHER_WINDOW, 'Current.FeelsLike'     , feelsLike)
         setProperty(WEATHER_WINDOW, 'Current.DewPoint'      , dewPoint)
         setProperty(WEATHER_WINDOW, 'Current.UVIndex'       , UV)
+        setProperty(WEATHER_WINDOW, 'Current.Sunrise'       , sunrise)
+        setProperty(WEATHER_WINDOW, 'Current.Sunset'        , sunset)
+        setProperty(WEATHER_WINDOW, 'Current.RainSince9'   , rainSince9)
+        setProperty(WEATHER_WINDOW, 'Current.RainLastHr'    , rainLastHr)
         setProperty(WEATHER_WINDOW, 'Current.OutlookIcon'   , '%s.png' % 
weathercode)
         setProperty(WEATHER_WINDOW, 'Current.FanartCode'    , weathercode)
 
@@ -583,6 +614,8 @@ def propertiesPDOM(page, extendedFeatures):
             goodshortDate = time.strftime('%d %b %a', newdatetuple) #sets the 
format of the time tuple, taken from this table 
http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior
             setProperty(WEATHER_WINDOW, 'Daily.%i.ShortDate' % count, 
str(goodshortDate))
             setProperty(WEATHER_WINDOW, 'Day%i.Title'       % count, day)
+            setProperty(WEATHER_WINDOW, 'Day%i.RainChance'       % count, 
rainChanceList[count])
+            setProperty(WEATHER_WINDOW, 'Day%i.RainChanceAmount'       % 
count, common.replaceHTMLCodes(rainAmountList[count]))
             setProperty(WEATHER_WINDOW, 'Day%i.HighTemp'    % count, 
maxList[count])
             setProperty(WEATHER_WINDOW, 'Day%i.LowTemp'     % count, 
minList[count])
             setProperty(WEATHER_WINDOW, 'Day%i.Outlook'     % count, desc)
diff --git a/weather.ozweather/resources/lib/b808common/b808common.py 
b/weather.ozweather/resources/lib/b808common/b808common.py
index db5fd52..0a884c3 100644
--- a/weather.ozweather/resources/lib/b808common/b808common.py
+++ b/weather.ozweather/resources/lib/b808common/b808common.py
@@ -1,8 +1,8 @@
 ### Common Code for bossanova808 addons
-### By bossanova808 2012
+### By bossanova808 2013
 ### Free in all senses....
 
-### VERSION 0.0.8
+### VERSION 0.1.4 Dec 2013
 
 import xbmc
 import xbmcaddon
@@ -13,6 +13,7 @@ import urllib
 import sys
 import os
 import platform
+import socket
 
 from traceback import print_exc
 
@@ -56,10 +57,10 @@ def notify(messageLine1, messageLine2 = "", time = 4000):
 def footprints(startup=True):
 
   if startup:
-    logNotice( ADDONNAME + " (Author: " + AUTHOR + ") ********************* 
Starting ...")
+    logNotice( ADDONNAME + " (Author: " + AUTHOR + ") Starting ...")
     logNotice( "Called as: " + str(sys.argv))
   else:
-    logNotice( ADDONNAME + " (Author: " + AUTHOR + ") ********************* 
Exiting ....")
+    logNotice( ADDONNAME + " (Author: " + AUTHOR + ") Exiting ....")
 
 
 
################################################################################
@@ -67,6 +68,35 @@ def footprints(startup=True):
 ### MIXED UTILITY FUNCTIONS
 
 
################################################################################
+# Log the users local IP address
+
+def logLocalIP():
+    #log the local IP address
+    try:
+        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+        #connect to google DNS as it's always up...
+        s.connect(('8.8.8.8',80))
+        log("Local IP is " + str(s.getsockname()[0]))
+        s.close()
+    except:
+        pass
+
+################################################################################
+# front pad a string with 0s out to 9 chars long
+
+def frontPadTo9Chars(shortStr):
+    while len(shortStr)<9:
+        shortStr = "0" + shortStr
+    return shortStr
+
+################################################################################
+# Reverse the key value pairs in a dict
+
+def swap_dictionary(original_dict):
+   return dict([(v, k) for (k, v) in original_dict.iteritems()])
+
+
+################################################################################
 # send a JSON command to XBMC and log the human description, json string, and
 # the result returned
 
@@ -243,7 +273,14 @@ elif "raspbmc" in uname or "armv6l" in uname:
   SYSTEM = "arm"
 
 #log the detemined system type
-log(ADDONNAME + "-" + VERSION + ": ### uname is: " + str(uname))
-log(ADDONNAME + "-" + VERSION + ": ### System is " + SYSTEM)
+log("uname is: " + str(uname))
+log("System is " + SYSTEM)
+
+XBMC_VERSION = "Frodo"
+log(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[0:4])
+version_number = 
float(xbmcaddon.Addon('xbmc.addon').getAddonInfo('version')[0:4])
+if version_number >= 12.9:
+    XBMC_VERSION = "Gotham" 
+log("XBMC Version is " + XBMC_VERSION)
 
 

-----------------------------------------------------------------------

Summary of changes:
 weather.ozweather/addon.xml                        |    2 +-
 weather.ozweather/changelog.txt                    |    3 +
 weather.ozweather/default.py                       |   41 +++++++++++++++--
 .../resources/lib/b808common/b808common.py         |   49 +++++++++++++++++--
 4 files changed, 84 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to