Skip to content

Commit

Permalink
release: sync wunderground with addons repo
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed Mar 21, 2012
1 parent 62dda1b commit ef5c76c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions addons/weather.wunderground/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="weather.wunderground" name="Weather Underground" version="0.0.7" provider-name="Team XBMC">
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="weather.wunderground" name="Weather Underground" version="0.0.9" provider-name="Team XBMC">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
Expand Down
7 changes: 7 additions & 0 deletions addons/weather.wunderground/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v0.0.9
- clear 7 day labels not 6
- save only the actual location code

v0.0.8
- fix error if no internet connection is available when searching for a location

v0.0.7
- fix: import error on Windows with non/extended-ascii profile paths

Expand Down
20 changes: 11 additions & 9 deletions addons/weather.wunderground/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from utilities import *

LOCATION_URL = 'http://autocomplete.wunderground.com/aq?query=%s&format=JSON'
WEATHER_URL = 'http://api.wunderground.com/api/%s/conditions/forecast7day/hourly%s.json'
WEATHER_URL = 'http://api.wunderground.com/api/%s/conditions/forecast7day/hourly/q/%s.json'
GEOIP_URL = 'http://api.wunderground.com/api/%s/geolookup/q/autoip.json'
A_I_K = 'NDEzNjBkMjFkZjFhMzczNg=='
WEATHER_WINDOW = xbmcgui.Window(12600)
Expand Down Expand Up @@ -78,17 +78,18 @@ def location(string):
loc = []
locid = []
query = fetch(LOCATION_URL % (urllib2.quote(string)))
for item in query['RESULTS']:
location = item['name']
locationid = item['l']
loc.append(location)
locid.append(locationid)
if query != '':
for item in query['RESULTS']:
location = item['name']
locationid = item['l'][3:]
loc.append(location)
locid.append(locationid)
return loc, locid

def geoip():
data = fetch(GEOIP_URL % aik[::-1])
if data != '' and data.has_key('location'):
location = data['location']['l']
location = data['location']['l'][3:]
__addon__.setSetting('Location1', data['location']['city'])
__addon__.setSetting('Location1id', location)
else:
Expand Down Expand Up @@ -147,9 +148,10 @@ def properties(query):
if location == '':
location = geoip()
if not location == '':
if location.startswith('/q/'): # backwards compatibility
location = location[3:]
forecast(location)
else:
# workaround to fix incrementing values on each weather refresh when no locations are set up:
set_property('Current.Condition' , 'N/A')
set_property('Current.Temperature' , '0')
set_property('Current.Wind' , '0')
Expand All @@ -160,7 +162,7 @@ def properties(query):
set_property('Current.DewPoint' , '0')
set_property('Current.OutlookIcon' , 'na.png')
set_property('Current.FanartCode' , 'na')
for count in range (0, MAXDAYS):
for count in range (0, MAXDAYS+1):
set_property('Day%i.Title' % count, 'N/A')
set_property('Day%i.HighTemp' % count, '0')
set_property('Day%i.LowTemp' % count, '0')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<string id="30101">所在地设置</string>
<string id="30111">更改地点1</string>
Expand Down

0 comments on commit ef5c76c

Please sign in to comment.