diff options
author | Zeljko Ametovic <amet1977@gmail.com> | 2012-03-02 23:42:30 -0800 |
---|---|---|
committer | Zeljko Ametovic <amet1977@gmail.com> | 2012-03-02 23:42:30 -0800 |
commit | 93d4cb6bd1612fb697de397b1bbb98b2be3d7e71 (patch) | |
tree | bbb1169b9f55bfd65a736313cad9ffc97b51ba5f /addons | |
parent | 91c4f01631dcb0641fa54ff1a86a4257a441e23b (diff) | |
parent | 45b1c007bbe337ee1c98bb8050038abcb21dce91 (diff) |
Merge pull request #749 from ronie/weather-na
ignore various na values in wu data. fixes #12740
Diffstat (limited to 'addons')
-rw-r--r-- | addons/weather.wunderground/addon.xml | 2 | ||||
-rw-r--r-- | addons/weather.wunderground/changelog.txt | 4 | ||||
-rw-r--r-- | addons/weather.wunderground/default.py | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/addons/weather.wunderground/addon.xml b/addons/weather.wunderground/addon.xml index fa37e8ec06..98556927c7 100644 --- a/addons/weather.wunderground/addon.xml +++ b/addons/weather.wunderground/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="weather.wunderground" name="Weather Underground" version="0.0.5" provider-name="Team XBMC"> +<addon id="weather.wunderground" name="Weather Underground" version="0.0.6" provider-name="Team XBMC"> <requires> <import addon="xbmc.python" version="2.0"/> <import addon="script.module.simplejson" version="2.0.10"/> diff --git a/addons/weather.wunderground/changelog.txt b/addons/weather.wunderground/changelog.txt index 62596ec82e..5a94e3ef9d 100644 --- a/addons/weather.wunderground/changelog.txt +++ b/addons/weather.wunderground/changelog.txt @@ -1,3 +1,7 @@ +v0.0.6 +- ignore various n/a values in wu data +- use kph value for windspeed + v0.0.5 - add geoip support - fetch 7 day forecast diff --git a/addons/weather.wunderground/default.py b/addons/weather.wunderground/default.py index 86d07c70a0..ab52420a2b 100644 --- a/addons/weather.wunderground/default.py +++ b/addons/weather.wunderground/default.py @@ -68,7 +68,8 @@ def fetch(url): except: json_string = '' try: - parsed_json = simplejson.loads(json_string) + json_clean = json_string.replace('"-9999.00"','""').replace('"-9998"','""').replace('"NA"','""') + parsed_json = simplejson.loads(json_clean) except: parsed_json = '' return parsed_json @@ -103,7 +104,7 @@ def properties(query): weathercode = WEATHER_CODES[query['current_observation']['icon_url'][31:-4]] set_property('Current.Condition' , query['current_observation']['weather']) set_property('Current.Temperature' , str(query['current_observation']['temp_c'])) - set_property('Current.Wind' , str(int(query['current_observation']['wind_mph'] * 1.609344))) + set_property('Current.Wind' , str(query['current_observation']['wind_kph'])) set_property('Current.WindDirection' , query['current_observation']['wind_dir']) set_property('Current.Humidity' , query['current_observation']['relative_humidity'].rstrip('%')) set_property('Current.FeelsLike' , str((int(query['hourly_forecast'][0]['feelslike']['english'])-32)*5/9)) |