From f1015c5b794922f98694b1c505fc655b59cfe83f Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 12 Jun 2022 18:31:44 +0800 Subject: [PATCH] fixed daily forecase hi low wrong temp bug --- stockTicker.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 6da31b0..5dca0f4 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -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'])