Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[weather.multi] 0.0.6 #1903

Merged
merged 1 commit into from Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions weather.multi/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="weather.multi" name="Multi Weather" version="0.0.5" provider-name="ronie">
<addon id="weather.multi" name="Multi Weather" version="0.0.6" provider-name="ronie">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.openweathermap.maps" version="1.0.4"/>
Expand All @@ -18,6 +18,6 @@
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>- fix crash when precipitation data is missing</news>
<news>- fix yahoo weather</news>
</extension>
</addon>
3 changes: 3 additions & 0 deletions weather.multi/changelog.txt
@@ -1,3 +1,6 @@
v0.0.6
- fix yahoo weather

v0.0.5
- fix crash when precipitation data is missing

Expand Down
2 changes: 1 addition & 1 deletion weather.multi/lib/utils.py
Expand Up @@ -19,7 +19,7 @@
DEBUG = ADDON.getSettingBool('Debug')

WEATHER_WINDOW = xbmcgui.Window(12600)
WEATHER_ICON = xbmc.translatePath('%s.png')
WEATHER_ICON = xbmcvfs.translatePath('%s.png')
TEMPUNIT = xbmc.getRegion('tempunit')
DATEFORMAT = xbmc.getRegion('dateshort')
TIMEFORMAT = xbmc.getRegion('meridiem')
Expand Down
5 changes: 3 additions & 2 deletions weather.multi/lib/weather.py
Expand Up @@ -76,14 +76,15 @@ def get_location(self, mode):
return location, locationid, locationlat, locationlon

def get_data(self, url):
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36'}
try:
response = requests.get(url)
response = requests.get(url, headers=headers, timeout=10)
return response.json()
except:
return

def get_forecast(self, loc, locid, lat, lon):
set_property('WeatherProviderLogo', xbmc.translatePath(os.path.join(CWD, 'resources', 'banner.png')))
set_property('WeatherProviderLogo', xbmcvfs.translatePath(os.path.join(CWD, 'resources', 'banner.png')))
log('weather location: %s' % locid)
providers = 'provided by Yahoo'
if MAPS and MAPID:
Expand Down