The branch, eden-pre has been updated
via 69c91dc5ce25969970ef3d3c7392f80082472f97 (commit)
via 0ffb2ee2a09dd4f9938aaa4dbf543587e52f141e (commit)
from 509a1b2f07994bf11b6c34abfaf1d14d1fc24013 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=69c91dc5ce25969970ef3d3c7392f80082472f97
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=0ffb2ee2a09dd4f9938aaa4dbf543587e52f141e
commit 0ffb2ee2a09dd4f9938aaa4dbf543587e52f141e
Author: amet <[email protected]>
Date: Wed Nov 16 23:43:26 2011 +0400
[weather.worldweatheronline] -v 1.0.3
- added Dew Point and Feels Like, thx to FrostBox
diff --git a/weather.worldweatheronline/addon.xml
b/weather.worldweatheronline/addon.xml
index a0d99bc..8bb02c0 100644
--- a/weather.worldweatheronline/addon.xml
+++ b/weather.worldweatheronline/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="weather.worldweatheronline"
name="World Weather Online"
- version="1.0.2"
+ version="1.0.3"
provider-name="Team XBMC">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/weather.worldweatheronline/changelog.txt
b/weather.worldweatheronline/changelog.txt
index b38c072..d8c962c 100644
--- a/weather.worldweatheronline/changelog.txt
+++ b/weather.worldweatheronline/changelog.txt
@@ -1,3 +1,6 @@
+1.0.3
+- added Dew Point and Feels Like, thx to FrostBox
+
1.0.2
- updated description
- fix: day string conversion will fail on non EN OS localization
diff --git a/weather.worldweatheronline/default.py
b/weather.worldweatheronline/default.py
index e4d5d54..63d9bd6 100644
--- a/weather.worldweatheronline/default.py
+++ b/weather.worldweatheronline/default.py
@@ -55,6 +55,9 @@ def clear_properties():
set_property("Current.winddirection" , "")
set_property("Current.OutlookIcon" , "")
set_property("Current.FanartCode" , "")
+ set_property("Current.FeelsLike" , "")
+ set_property("Current.DewPoint" , "")
+
for i in range(4):
set_property("Day%i.Title" % i , "")
set_property("Day%i.HighTemp" % i , "")
@@ -110,27 +113,32 @@ def location(string):
def forecast(city):
log("get forecast for '%s'" % (city,))
- query = fetch( LOCATION_URL % (city, NUMBER_OF_DAYS, DEVELOPER_KEY))
- current = query.getElementsByTagName("current_condition")[0]
-
+ query = fetch( LOCATION_URL % (city, NUMBER_OF_DAYS, DEVELOPER_KEY))
+ current = query.getElementsByTagName("current_condition")[0]
+ celsius = get_elements(current,"temp_C")
+ humidity = get_elements(current,"humidity")
+ wind = get_elements(current,"windspeedKmph")
+ code = get_elements(current,"weatherCode")
+
set_property("Current.Condition" ,
get_elements(current,"weatherDesc")) # current condition in words
- set_property("Current.Temperature" , get_elements(current,"temp_C"))
# temp in C, no need to set F, XBMC will convert it
- set_property("Current.Wind" ,
get_elements(current,"windspeedKmph")) # wind speed in Km/h, no need for mph
as XBMC will do the conversion
- set_property("Current.Humidity" , get_elements(current,"humidity"))
# Humidity in %
- set_property("Current.winddirection" ,
get_elements(current,"winddir16Point")) # wind direction
- code = get_elements(current,"weatherCode")
+ set_property("Current.Temperature" , celsius)
# temp in C, no need to set F, XBMC will convert it
+ set_property("Current.Wind" , wind)
# wind speed in Km/h, no need for mph as XBMC will do the conversion
+ set_property("Current.Humidity" , humidity)
# Humidity in %
+ set_property("Current.winddirection" ,
get_elements(current,"winddir16Point")) # wind direction
+ set_property("Current.FeelsLike" , getFeelsLike(int(celsius),
int(wind))) # Feels like
+ set_property("Current.DewPoint" , getDewPoint(int(celsius),
int(humidity)))# Dew Point
set_property("Current.OutlookIcon" , "%s.png" % WEATHER_CODES[code])
# condition icon, utilities.py has more on this
set_property("Current.FanartCode" , WEATHER_CODES[code])
# fanart icon, utilities.py has more on this
weather = query.getElementsByTagName("weather")
i = 0
for day in weather:
+ code = get_elements(day,"weatherCode")
date = strptime(get_elements(day,"date"), '%Y-%m-%d')
set_property("Day%i.Title" % i , DAYS[int(strftime('%w', date))])
# Day of the week
set_property("Day%i.HighTemp" % i , get_elements(day,"tempMaxC"))
# Max Temp for that day, C only XBMC will do the conversion
set_property("Day%i.LowTemp" % i , get_elements(day,"tempMinC"))
# Min temperature for that day, C only XBMC will do the conversion
- set_property("Day%i.Outlook" % i , get_elements(day,"weatherDesc"))
# days condition in words
- code = get_elements(day,"weatherCode")
+ set_property("Day%i.Outlook" % i , get_elements(day,"weatherDesc"))
# days condition in words
set_property("Day%i.OutlookIcon" % i , "%s.png" % WEATHER_CODES[code])
# condition icon, utilities.py has more on this
set_property("Day%i.FanartCode" % i , WEATHER_CODES[code])
# fanart icon, utilities.py has more on this
i += 1
diff --git a/weather.worldweatheronline/resources/lib/utilities.py
b/weather.worldweatheronline/resources/lib/utilities.py
index 765762c..cd5e8fc 100644
--- a/weather.worldweatheronline/resources/lib/utilities.py
+++ b/weather.worldweatheronline/resources/lib/utilities.py
@@ -2,6 +2,7 @@
import sys
import xbmc
+import math
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
@@ -64,4 +65,53 @@ WEATHER_CODES = { '395' : '42', # Moderate or heavy snow
in area with thunder
}
def log(msg):
- xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=xbmc.LOGDEBUG )
\ No newline at end of file
+ xbmc.log("### [%s] - %s" % (__scriptname__,msg,),level=xbmc.LOGDEBUG )
+
+
+#### below thanks to FrostBox @
http://forum.xbmc.org/showthread.php?p=937168#post937168
+
+def getFeelsLike( T=10, V=25 ):
+ """ The formula to calculate the equivalent temperature related to the
wind chill is:
+ T(REF) = 13.12 + 0.6215 * T - 11.37 * V**0.16 + 0.3965 * T * V**0.16
+ Or:
+ T(REF): is the equivalent temperature in degrees Celsius
+ V: is the wind speed in km/h measured at 10m height
+ T: is the temperature of the air in degrees Celsius
+ source: http://zpag.tripod.com/Meteo/eolien.htm
+
+ getFeelsLike( tCelsius, windspeed )
+ """
+ FeelsLike = T
+ #Wind speeds of 4 mph or less, the wind chill temperature is the same as
the actual air temperature.
+ if round( ( V + .0 ) / 1.609344 ) > 4:
+ FeelsLike = ( 13.12 + ( 0.6215 * T ) - ( 11.37 * V**0.16 ) + ( 0.3965
* T * V**0.16 ) )
+ #
+ return str( round( FeelsLike ) )
+
+
+def getDewPoint( Tc=0, RH=93, minRH=( 0, 0.075 )[ 0 ] ):
+ """ Dewpoint from relative humidity and temperature
+ If you know the relative humidity and the air temperature,
+ and want to calculate the dewpoint, the formulas are as follows.
+
+ getDewPoint( tCelsius, humidity )
+ """
+ #First, if your air temperature is in degrees Fahrenheit, then you must
convert it to degrees Celsius by using the Fahrenheit to Celsius formula.
+ # Tc = 5.0 / 9.0 * ( Tf - 32.0 )
+ #The next step is to obtain the saturation vapor pressure(Es) using this
formula as before when air temperature is known.
+ Es = 6.11 * 10.0**( 7.5 * Tc / ( 237.7 + Tc ) )
+ #The next step is to use the saturation vapor pressure and the relative
humidity to compute the actual vapor pressure(E) of the air. This can be done
with the following formula.
+ #RH=relative humidity of air expressed as a percent. or except
minimum(.075) humidity to abort error with math.log.
+ RH = RH or minRH #0.075
+ E = ( RH * Es ) / 100
+ #Note: math.log( ) means to take the natural log of the variable in the
parentheses
+ #Now you are ready to use the following formula to obtain the dewpoint
temperature.
+ try:
+ DewPoint = ( -430.22 + 237.7 * math.log( E ) ) / ( -math.log( E ) +
19.08 )
+ except ValueError:
+ #math domain error, because RH = 0%
+ #return "N/A"
+ DewPoint = 0 #minRH
+ #Note: Due to the rounding of decimal places, your answer may be slightly
different from the above answer, but it should be within two degrees.
+ return str( int( DewPoint ) )
+
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
.../LICENSE.txt | 0
script.module.brightcove/README | 1 +
.../addon.xml | 2 +-
script.module.brightcove/changelog.txt | 2 +
.../lib/brightcove}/__init__.py | 0
script.module.brightcove/lib/brightcove/api.py | 196 ++++++++++++++++++++
script.module.brightcove/lib/brightcove/core.py | 139 ++++++++++++++
.../lib/brightcove/decorators.py | 99 ++++++++++
script.module.brightcove/lib/brightcove/objects.py | 140 ++++++++++++++
.../lib/setup.py | 18 +--
weather.worldweatheronline/addon.xml | 2 +-
weather.worldweatheronline/changelog.txt | 3 +
weather.worldweatheronline/default.py | 28 ++-
.../resources/lib/utilities.py | 52 +++++-
14 files changed, 656 insertions(+), 26 deletions(-)
copy {script.mpdc => script.module.brightcove}/LICENSE.txt (100%)
create mode 100644 script.module.brightcove/README
copy {script.module.xbmcswift => script.module.brightcove}/addon.xml (72%)
create mode 100644 script.module.brightcove/changelog.txt
copy {script.extrafanartdownloader/resources =>
script.module.brightcove/lib/brightcove}/__init__.py (100%)
create mode 100644 script.module.brightcove/lib/brightcove/api.py
create mode 100644 script.module.brightcove/lib/brightcove/core.py
create mode 100644 script.module.brightcove/lib/brightcove/decorators.py
create mode 100644 script.module.brightcove/lib/brightcove/objects.py
copy {script.module.xbmcswift => script.module.brightcove}/lib/setup.py (59%)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons