revert weather
This commit is contained in:
parent
2309233ebe
commit
9803a9ac41
@ -283,15 +283,14 @@ def updateWeather(api_key, logf):
|
|||||||
current_locations = list(all_current_settings['locations'].keys())
|
current_locations = list(all_current_settings['locations'].keys())
|
||||||
daily_locations = list(all_daily_settings['locations'].keys())
|
daily_locations = list(all_daily_settings['locations'].keys())
|
||||||
|
|
||||||
print(current_locations, daily_locations)
|
|
||||||
all_locations = list(set(current_locations + daily_locations))
|
all_locations = list(set(current_locations + daily_locations))
|
||||||
print(all_locations)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
current_weathers = {}
|
||||||
|
daily_weathers = {}
|
||||||
|
|
||||||
currents = []
|
|
||||||
dailys = []
|
|
||||||
|
|
||||||
|
|
||||||
for location in all_locations:
|
for location in all_locations:
|
||||||
@ -320,7 +319,8 @@ def updateWeather(api_key, logf):
|
|||||||
current_weather['rain_chance'] = r.json()['hourly'][0]['pop']
|
current_weather['rain_chance'] = r.json()['hourly'][0]['pop']
|
||||||
|
|
||||||
|
|
||||||
currents.append(current_weather)
|
if location in current_locations:
|
||||||
|
current_weathers[location] = current_weather
|
||||||
|
|
||||||
daily_weather = []
|
daily_weather = []
|
||||||
daily = r.json()['daily']
|
daily = r.json()['daily']
|
||||||
@ -344,25 +344,9 @@ def updateWeather(api_key, logf):
|
|||||||
daily_weather[0]['wind_direction'] = current_weather['wind_direction']
|
daily_weather[0]['wind_direction'] = current_weather['wind_direction']
|
||||||
daily_weather[0]['visibility'] = current_weather['visibility']
|
daily_weather[0]['visibility'] = current_weather['visibility']
|
||||||
|
|
||||||
dailys.append(daily_weather)
|
if location in daily_locations:
|
||||||
|
daily_weathers[location] = daily_weather
|
||||||
|
|
||||||
current_weathers = {}
|
|
||||||
daily_weathers = {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for l in current_locations:
|
|
||||||
for i,loc in enumerate(all_locations):
|
|
||||||
if l == loc:
|
|
||||||
current_weathers[location] = currents[i]
|
|
||||||
|
|
||||||
for l in daily_locations:
|
|
||||||
for i,loc in enumerate(all_locations):
|
|
||||||
if l == loc:
|
|
||||||
daily_weathers[location] = dailys[i]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -380,7 +364,6 @@ def updateWeather(api_key, logf):
|
|||||||
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
logf.write('. line: ' + str(exc_tb.tb_lineno))
|
||||||
logf.write('. type: ' + str(exc_type))
|
logf.write('. type: ' + str(exc_type))
|
||||||
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
|
|
||||||
|
|
||||||
def updateLeagueTables(api_key, logf):
|
def updateLeagueTables(api_key, logf):
|
||||||
print('LEAGUE TABLES')
|
print('LEAGUE TABLES')
|
||||||
|
Loading…
Reference in New Issue
Block a user