diff options
author | Martijn Kaijser <mcm.kaijser@gmail.com> | 2012-12-01 13:00:30 +0100 |
---|---|---|
committer | Martijn Kaijser <mcm.kaijser@gmail.com> | 2012-12-01 13:00:30 +0100 |
commit | af7102d32c19dc511f51767731686d042a1da691 (patch) | |
tree | 49c58af217ee511cfe188e1358c9e85e9b849df3 /addons/weather.wunderground/default.py | |
parent | c81334142cdd64b7d5b1db7e6336588d472452d7 (diff) |
[addons] sync packaged addons/scrapers with Frodo repo
Diffstat (limited to 'addons/weather.wunderground/default.py')
-rw-r--r-- | addons/weather.wunderground/default.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/addons/weather.wunderground/default.py b/addons/weather.wunderground/default.py index 7b8f437f1c..38edc88cdc 100644 --- a/addons/weather.wunderground/default.py +++ b/addons/weather.wunderground/default.py @@ -556,16 +556,24 @@ def properties(data,loc): zoom = '10.0' url = data['satellite']['image_url_ir4'].replace('width=300&height=300','width=640&height=360').replace('radius=75','radius=%i' % int(1000/int(zoom.rstrip('0').rstrip('.,')))) log('map url: %s' % url) - req = urllib2.urlopen(url) - response = req.read() - req.close() - timestamp = time.strftime('%Y%m%d%H%M%S') - mapfile = xbmc.translatePath('special://profile/addon_data/%s/map/%s-%s.png' % (__addonid__,locid,timestamp)) - tmpmap = open(mapfile, 'wb') - tmpmap.write(response) - tmpmap.close() - log('satellite image downloaded') - set_property('MapPath', mapdir) + try: + req = urllib2.urlopen(url) + response = req.read() + req.close() + log('satellite image downloaded') + except: + response = '' + log('satellite image downloaded failed') + if response != '': + timestamp = time.strftime('%Y%m%d%H%M%S') + mapfile = xbmc.translatePath('special://profile/addon_data/%s/map/%s-%s.png' % (__addonid__,locid,timestamp)) + try: + tmpmap = open(mapfile, 'wb') + tmpmap.write(response) + tmpmap.close() + set_property('MapPath', mapdir) + except: + log('failed to save satellite image') log('version %s started: %s' % (__version__, sys.argv)) log('lang: %s' % LANGUAGE) |