Skip to content

Commit

Permalink
Fix OpenWeatherMap
Browse files Browse the repository at this point in the history
  • Loading branch information
RingOV committed Jul 9, 2019
1 parent 00fd353 commit 1c55faa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gis-weather.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#
# gis_weather.py
v = '0.8.3.17'
v = '0.8.3.18'
# Copyright (C) 2013-2019 Alexander Koltsov <ringov@mail.ru>
#
# This program is free software: you can redistribute it and/or modify
Expand Down
14 changes: 7 additions & 7 deletions services/openweathermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def get_weather():
# update time
dt = datetime.utcfromtimestamp(source['dt']+source['timezone'])
time_update = [dt.strftime('%H:%M')]
day = [dt.strftime('%a')]
date = [dt.strftime('%d.%m')]

# weather text now
text_now = [source['weather'][0]['description']]
Expand Down Expand Up @@ -183,17 +185,17 @@ def get_weather():
for data in source['list']:
t=str(round(data['main']['temp']))
dt = datetime.utcfromtimestamp(data['dt']+source['city']['timezone'])
day=dt.strftime('%a')
date=dt.strftime('%d.%m')
_day=dt.strftime('%a')
_date=dt.strftime('%d.%m')
_time=dt.strftime('%H:%M')
icon='http://openweathermap.org/img/w/'+data['weather'][0]['icon']+'.png'
text=data['weather'][0]['description']
wind_speed=str(round(data['wind']['speed']))
wind_direct=wind_direct_convert.convert(data['wind']['deg'])
wt2.append({
't':t,
'day': day,
'date': date,
'day': _day,
'date': _date,
'time': _time,
'icon': icon,
'text': text,
Expand All @@ -203,7 +205,7 @@ def get_weather():

wt = [[]]
i = 0
_date = wt2[0]['date']
_date = date[0]
# true sort by date for local time
for item in wt2:
if _date != item['date']:
Expand All @@ -214,8 +216,6 @@ def get_weather():

t_day = ['']
t_night = ['']
day = [wt[0][0]['day']]
date = [wt[0][0]['date']]
icon = ['']
text = ['']
wind_speed = ['']
Expand Down

0 comments on commit 1c55faa

Please sign in to comment.