revert weather

This commit is contained in:
Neythen Treloar 2022-03-08 10:24:54 +00:00 committed by GitHub
parent 2309233ebe
commit 9803a9ac41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,15 +283,14 @@ def updateWeather(api_key, logf):
current_locations = list(all_current_settings['locations'].keys())
daily_locations = list(all_daily_settings['locations'].keys())
print(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:
@ -320,7 +319,8 @@ def updateWeather(api_key, logf):
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 = r.json()['daily']
@ -344,25 +344,9 @@ def updateWeather(api_key, logf):
daily_weather[0]['wind_direction'] = current_weather['wind_direction']
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('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
def updateLeagueTables(api_key, logf):
print('LEAGUE TABLES')