fixed daily forecase hi low wrong temp bug

This commit is contained in:
Justin 2022-06-12 18:31:44 +08:00 committed by GitHub
parent e89d486228
commit f1015c5b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2331,9 +2331,13 @@ class StockTicker():
main = daily_weather[0]['main_weather']
if main == 'Clouds':
main = daily_weather[0]['description']
if main == 'Rain':
main = daily_weather[0]['description']
weather_ids = {'Clear': '01', 'few clouds': '02', 'scattered clouds': '03', 'broken clouds':'04', 'overcast clouds':'04', 'Drizzle':'09',
'Rain':'10', 'Thunderstorm':'11', 'Snow':'13', 'Mist': '50', 'Smoke': '50', 'Haze': '50', 'Dust': '50', 'Fog': '50',
'Sand': '50', 'Ash': '50', 'Squall': '50', 'Tornado': '50'}
'Sand': '50', 'Ash': '50', 'Squall': '50', 'Tornado': '50', 'light rain': '10', 'moderate rain': '10', 'heavy intensity rain': '10',
'very heavy rain': '10', 'extreme rain': '10', 'freezing rain': '13', 'light intensity shower rain': '09', 'shower rain': '09',
'heavy intensity shower rain': '09', 'ragged shower rain': '09'}
weather_dir = './logos/weather_icons'
@ -2406,8 +2410,8 @@ class StockTicker():
x_offset += max( main_img.size[0], temp_img.size[0] + deg_img.size[0])
img.paste(min_img, (x_offset - 1, 12))
img.paste(max_img, (x_offset - 1, 21))
img.paste(min_img, (x_offset - 0, 12))
img.paste(max_img, (x_offset - 0, 21))
x_offset += max(min_img.size[0], max_img.size[0]) + 2
@ -2454,7 +2458,7 @@ class StockTicker():
#img.paste(date_img, (70, 0))
x_offset = 77
for i in range(1,len(daily_weather)-1):
for i in range(1,len(daily_weather)):
weekday = weekdays[(datetime.today().weekday() + i)%7]
day_img = self.textImage( weekday.upper(), small_font)
@ -2464,11 +2468,12 @@ class StockTicker():
if main == 'Clouds':
main = weather['description']
if main == 'Rain':
main = weather['description']
min_temp = self.convertTemp(weather['min_temp'], daily_weathers['temp'])
max_temp = self.convertTemp(weather['max_temp'], daily_weathers['temp'])
min_temp = self.convertTemp(weather['min_temp'], daily_weathers['temp'])
max_temp = self.convertTemp(weather['max_temp'], daily_weathers['temp'])