From 02274e9d0e0f8de6f18fa4902c8d343d96d70a69 Mon Sep 17 00:00:00 2001 From: Neythen Date: Tue, 8 Jun 2021 21:16:08 +0100 Subject: [PATCH] weather updates --- api_caller.py | 5 +- csv/crypto.csv | 4 +- csv/current_weather.json | 2 +- csv/daily_weather.json | 2 +- csv/last_update.csv | 2 +- csv/news.csv | 40 ++--- csv/tickers.csv | 6 +- display_image | Bin 0 -> 1415 bytes display_image.ppm | Bin 0 -> 2105 bytes final.ppm | Bin 113391 -> 113391 bytes final1.ppm | Bin 113391 -> 113391 bytes logos/weather_icons/small_icons/01.png | Bin 0 -> 165 bytes logos/weather_icons/small_icons/02.png | Bin 0 -> 189 bytes logos/weather_icons/small_icons/03.png | Bin 0 -> 162 bytes logos/weather_icons/small_icons/04.png | Bin 0 -> 187 bytes logos/weather_icons/small_icons/09.png | Bin 0 -> 210 bytes logos/weather_icons/small_icons/10.png | Bin 0 -> 199 bytes logos/weather_icons/small_icons/11.png | Bin 0 -> 215 bytes logos/weather_icons/small_icons/13.png | Bin 0 -> 168 bytes logos/weather_icons/small_icons/50.png | Bin 0 -> 157 bytes stockTicker.py | 235 ++++++++++++++++++++----- weather.ppm | Bin 21614 -> 21614 bytes 22 files changed, 219 insertions(+), 77 deletions(-) create mode 100644 display_image create mode 100755 display_image.ppm create mode 100644 logos/weather_icons/small_icons/01.png create mode 100644 logos/weather_icons/small_icons/02.png create mode 100644 logos/weather_icons/small_icons/03.png create mode 100644 logos/weather_icons/small_icons/04.png create mode 100644 logos/weather_icons/small_icons/09.png create mode 100644 logos/weather_icons/small_icons/10.png create mode 100644 logos/weather_icons/small_icons/11.png create mode 100644 logos/weather_icons/small_icons/13.png create mode 100644 logos/weather_icons/small_icons/50.png diff --git a/api_caller.py b/api_caller.py index 5655817..afc9411 100644 --- a/api_caller.py +++ b/api_caller.py @@ -245,6 +245,8 @@ def updateWeather(location, api_key): current_weather['wind_direction'] = weather['wind']['deg'] current_weather['visibility'] = weather['visibility'] current_weather['uv'] = r.json()['current']['uvi'] + current_weather['rain_chance'] = r.json()['hourly'][0]['pop'] + json.dump( current_weather, open( "csv/current_weather.json", 'w+' )) @@ -259,8 +261,7 @@ def updateWeather(location, api_key): dct['min_temp'] = day['temp']['min'] dct['max_temp'] = day['temp']['max'] daily_weather.append(dct) - - + json.dump( daily_weather, open( "csv/daily_weather.json", 'w+' )) if __name__ == '__main__': diff --git a/csv/crypto.csv b/csv/crypto.csv index 26c4367..8918976 100644 --- a/csv/crypto.csv +++ b/csv/crypto.csv @@ -1,3 +1,3 @@ symbol,name,base,current,24hr change -BTC,bitcoin,usd,35668,-0.37786061371520613 -ETH,ethereum,gbp,1923.94,1.8341326495198176 +BTC,bitcoin,usd,32887,-7.6081007271389165 +ETH,ethereum,gbp,1768.04,-8.205044425803774 diff --git a/csv/current_weather.json b/csv/current_weather.json index 1f0460e..93698e2 100644 --- a/csv/current_weather.json +++ b/csv/current_weather.json @@ -1 +1 @@ -{"main_weather": "Clouds", "description": "overcast clouds", "temp": 18.69, "min_temp": 15.77, "max_temp": 20.06, "feels_like": 18.44, "humidity": 70, "clouds": 100, "wind_speed": 2.44, "wind_direction": 228, "visibility": 10000, "uv": 0} \ No newline at end of file +{"main_weather": "Clouds", "description": "overcast clouds", "temp": 19.73, "min_temp": 15.55, "max_temp": 21.01, "feels_like": 19.27, "humidity": 58, "clouds": 100, "wind_speed": 1.84, "wind_direction": 249, "visibility": 10000, "uv": 0, "rain_chance": 0} \ No newline at end of file diff --git a/csv/daily_weather.json b/csv/daily_weather.json index c66ce9e..23d25e0 100644 --- a/csv/daily_weather.json +++ b/csv/daily_weather.json @@ -1 +1 @@ -[{"main_weather": "Clouds", "description": "few clouds", "min_temp": 12.92, "max_temp": 22.21}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 12.67, "max_temp": 22.49}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 13.03, "max_temp": 23.86}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 14.72, "max_temp": 24.46}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 15.5, "max_temp": 25.79}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 16.59, "max_temp": 28.09}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 16.34, "max_temp": 27.22}, {"main_weather": "Rain", "description": "light rain", "min_temp": 17.53, "max_temp": 28.72}] \ No newline at end of file +[{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 13.24, "max_temp": 23.67}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 12.23, "max_temp": 23.89}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.69, "max_temp": 22.98}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.9, "max_temp": 24.55}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 15.43, "max_temp": 25.91}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 16.26, "max_temp": 27.68}, {"main_weather": "Rain", "description": "light rain", "min_temp": 17.66, "max_temp": 29.24}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 16.08, "max_temp": 23.33}] \ No newline at end of file diff --git a/csv/last_update.csv b/csv/last_update.csv index d4ef133..1077c0c 100644 --- a/csv/last_update.csv +++ b/csv/last_update.csv @@ -1 +1 @@ -07/06/2021 16:09:41 +08/06/2021 16:13:48 diff --git a/csv/news.csv b/csv/news.csv index 5910137..9e372d7 100644 --- a/csv/news.csv +++ b/csv/news.csv @@ -1,21 +1,21 @@ headline,source,date,time -macOS 12 Monterey announced - here's what's coming to MacBooks later in 2021 - TechRadar,TechRadar,2021-06-07,18:30:46Z -COVID vaccine: Period changes could be a short-term side effect - Times of India,The Times of India,2021-06-07,18:30:00Z -Today’s coronavirus news: Ontario reporting 525 COVID-19 cases; Ontario to begin reopening Friday; Toronto announces new outdoor fitness programs starting this weekend - Toronto Star,Toronto Star,2021-06-07,18:20:11Z -Arctic micro-animal survives 24000 years in Siberian permafrost - eNCA,eNCA,2021-06-07,18:20:10Z -Live updates: Harris warns Guatemalans they will be turned back if they come to the U.S. border illegally - The Washington Post,The Washington Post,2021-06-07,18:18:00Z -Leveraging past flu pandemics helps build universal flu vaccine - The Science Board,Scienceboard.net,2021-06-07,18:16:01Z -iPadOS 15 announced at WWDC^ features improved multitasking and surprising Swift Playgrounds features - Yahoo Singapore News,Yahoo Entertainment,2021-06-07,18:12:11Z -Apple announces watchOS 8 with new health features - The Verge,The Verge,2021-06-07,18:11:38Z -17 areas now COVID hotspots in UK cases as surge 53% in a week - Yahoo Philippines News,Yahoo Entertainment,2021-06-07,18:11:15Z -Apple’s Siri will finally work without an internet connection thanks to on-device processing - The Verge,The Verge,2021-06-07,18:07:17Z -tvOS is getting spatial audio support for AirPods Pro and Max - Yahoo Singapore News,Yahoo Entertainment,2021-06-07,18:07:02Z -2nd dose vaccine eligibility expands^ 2 new deaths linked to Alpha COVID-19 variant - Global News,Global News,2021-06-07,18:04:33Z -iPadOS 15 announced at WWDC^ features improved multitasking and surprising Swift Playgrounds features - Yahoo Movies Canada,Yahoo Entertainment,2021-06-07,18:04:33Z -Skin in the game: Video chat apps tout 'inclusive' AI features | Global Banking & Finance Review - Global Banking And Finance Review,Global Banking And Finance Review,2021-06-07,18:00:27Z -Covid 19 coronavirus: Fiji crisis - 147 cases in two days^ patient dies - New Zealand Herald,New Zealand Herald,2021-06-07,18:00:00Z -FDA approves Alzheimer's drug from Biogen^ against experts' advice - NBC News,NBC News,2021-06-07,17:59:36Z -Covid: Euro 2020 fan zone in Glasgow an 'absolute slap' for hospitality - BBC News,BBC News,2021-06-07,17:47:18Z -As AMC Entertainment stock surges 20%^ SEC says it's watching memes for 'disruptions of the market^ manipulative trading^ or other misconduct' - MarketWatch,MarketWatch,2021-06-07,17:47:00Z -Stream of stars extends thousands of light-years across the Milky Way - Phys.org,Phys.Org,2021-06-07,17:46:34Z -New Brunswick fails to meet vaccination target^ delays first phase of reopening plan - HalifaxToday.ca,HalifaxToday.ca,2021-06-07,17:45:58Z +Reduce your salt intake to boost your immunity - Times of India,The Times of India,2021-06-08,18:30:00Z +Geostationary Earth Orbit Hyperspectral Infrared Radiation Data Improves Local Severe Storm Forecasts - Space Bollyinside - BollyInside,Bollyinside.com,2021-06-08,18:27:29Z +Carbon dioxide levels hit 50 percent higher than preindustrial time - NBC News,NBC News,2021-06-08,18:23:31Z +Annual Solar Eclipse Tomorrow^ People of THESE Places in India Will be Able to Watch - India.com,India.com,2021-06-08,18:23:07Z +National Indigenous leaders plan Vatican visit to call for long-awaited papal apology - CBC.ca,CBC News,2021-06-08,18:15:57Z +N.B. says another 29000 people need to get vaccine before health orders are relaxed - NiagaraFallsReview.ca,Toronto Star,2021-06-08,18:11:50Z +Coroner determines Upper Hutt toddler's playground death was the result of 'tragic accident' - Stuff.co.nz,Stuff.co.nz,2021-06-08,18:06:00Z +Controversial scheme to collect and share patient data delayed - The Independent,Independent,2021-06-08,18:05:12Z +Minecraft updates with Cliffs and Caves Part 1^ adds goats and copper - Polygon,Polygon,2021-06-08,18:04:21Z +Utah Jazz rule PG Mike Conley out for Game 1 vs. LA Clippers with hamstring strain - ESPN,ESPN,2021-06-08,17:57:46Z +'This was a terrorist attack': Trudeau condemns London hit-and-run that left four Muslim family members dead - CBC.ca,CBC News,2021-06-08,17:56:14Z +Zidansek and Pavlyuchenkova reach French Open semis after epic battles - The Guardian,The Guardian,2021-06-08,17:51:00Z +New dinosaur species found in Australia was as long as a basketball court - NBC News,NBC News,2021-06-08,17:36:11Z +Julio Jones declines to take No. 11 from Tennessee Titans' A.J. Brown - ESPN,ESPN,2021-06-08,17:35:03Z +EXCLUSIVE: Listen to the full 40-minute Rudy Giuliani phone call with a Ukrainian presidential aide - CNN ,CNN,2021-06-08,17:35:00Z +Waterford dog attack: Dog that attacked and killed three-month-old baby girl is put down as post mortem carried out on child - Independent.ie,Independent.ie,2021-06-08,17:31:00Z +Missing bundles of joy: Govt can't find woman who gave birth to 10 babies - Eyewitness News,EWN,2021-06-08,17:25:17Z +UK housing market is on fire^ warns Bank of England chief economist - The Guardian,The Guardian,2021-06-08,17:22:00Z +Chris Harrison: The Bachelor host leaves for good over racism row - BBC News,BBC News,2021-06-08,17:19:39Z +COVID-19 Update: Three-day vaccination blitz at Telus Convention Centre | Delta variant outbreaks confirmed at Foothills | Alberta urges Ottawa to drop hotel quarantines - Calgary Herald,Calgary Herald,2021-06-08,17:15:00Z diff --git a/csv/tickers.csv b/csv/tickers.csv index c14628c..2c8fc08 100644 --- a/csv/tickers.csv +++ b/csv/tickers.csv @@ -1,4 +1,4 @@ name,current,opening -MSFT,253.81,249.98 -NFLX,494.66,492.9169 -GOOG,2466.09,2451.32 +MSFT,252.57,255.16 +NFLX,492.39,497 +GOOG,2482.85,2479.9 diff --git a/display_image b/display_image new file mode 100644 index 0000000000000000000000000000000000000000..535066171a087d5c2b4ad9272bc6bfaf89a2c938 GIT binary patch literal 1415 zcmV;21$g?2P)00001b5ch_0olnc ze*gdg32;bRa{vGf6951U69E94oEQKA1uRKKK~#90#h3|f6jd028;`_@N=(#51TUa$ zX$!^DP)oUbSZXbZcz_B4f>dJz7_S68YNG_Bm6jqzKw2X82m~UCjS>-oparEThtO7R zDW$D*?e6UCF*Cpadv9i$9k_r3rB-#@dBit5F|4IecW$wJ;nzClhP zZHSC$2IO@savb>zS%qXExAtbPp2&Q1B#@eP2Ki5J<5+|ixXaOB7U3fVdIpW5TtZad<7X*sx8 zycR^tnFHdCtdMig=a&F?Z*;_j_}D~H)^7x9_EVjhnw!CSrq_)&2Y6LY_@n$8#aBX*>SAsBUDrlG5L2Wn% z!oePCx;G zI+wDw+$vl`#Ln1Pp?vxoTSaXh_`a*e6nemw{|YFjn;=kA2U_bzkY+uJG7j+V*$e9F zvmiY>2Rt7ZLEzUa&{|qSE?fh?z579Hzf4QS`Sbz^oU8$@vlF~u@4PZs@dg$I%!;rfvN&`-xwygaWg%~$4?AtAw(=}BlRCV#3sN21xy!Bg=0Jp z-T=BNf|&UjmC<>DUL#IU18&4<@E<+KHjl>x@~U@1`|ARIPZr=_`8r!HV(x5Z%Qn!v z{;|)m60z2BV!nO*>43i7-(HDi!X!}7HPV_RwPWrm5+z|mGOa(gww`@&*B)#&GeNuD zK_fz1jVmvoN#kP7F}-D9fd9Zx_W4_g*q7nNRICSDlo;xu7#6kGauHM1j76M@TfCap zBGw%rJ&vYU!^l7&0M2;}L7F)Wbf=R>O-M?m5i}PP6x&`wYtuG=1rf^#C#H9F(m~{R z3WMjw=~`dmJ+Kg{ zv=2F-Ta2H{v<`Vk0*dB^l!LPQb9OyOltkULwkX&$EmD=%&QG4XI>-m)mZR3xh7hPa zL03i6McRYTap3uA9qnf%o$9&s^!6oXKMrbj4Hk46Ys`z5(eKLz@6-3rXBW{sihAZx z5T|Bb;~3N$BngBL+D;2vVnz=xaTbB_oG9_Wa)8 zLS&Agk)*3i*&c&lMC$rUkc?T2ynx)+BPp98d7_<-r>QNJS&f-3WCerN|T{6-nnEuYsEe zT*xA})FRbpw2i?NGNf{iZOtQZA~z4JkRg@AvHR5;Qe%VdLk|=gi4-Dt54MYW{0j<* V`1`7QW%&RA002ovPDHLkV1j%!k<0)9 literal 0 HcmV?d00001 diff --git a/display_image.ppm b/display_image.ppm new file mode 100755 index 0000000000000000000000000000000000000000..dd6603978f3d4978b92e5fe5801d5bf234329b0b GIT binary patch literal 2105 zcmV-92*&q`P)>H{T5QXeQelKMbNOOnqgy`enmjfA8(9F!iv zFXJT9xTS1*)ia<|hNZLg>VuK$E`?-A)A()Nz8*{<9yIk6CVEg4+o>nSJ!4VZQ zR5w({JEtV;>=0knCc~3POJ6LK36l2kdp{-Y*6=Z5AK^IR1YvWwy^80t$EEEiw!b2q zb5cboDZa3^J0V0Eyhybzotn}H&+-?FOp#P>)cXki2-69_5Ka<0GrIWhb2;}((h;4} zC)2+;*{?Y5T>1z}L_l!#5NDA< zxd^!{zOW_PC)7}Fm!n)2mn6+(n-9)zwWpm+-ykW}I9z)Deznowyg)a2yk3i_>OnHT zxGfnHZNi?b;*z9!Z1a{)TY#0|I6^C7ETP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Vm5xepw^xhsr$>(v+V=4tQesTaQz>FxZSA`VJ@6%yKbvoQ6J)fZABX zY?RDcg^r>$4)V%5LzS^qqo1cv1$f^)uw$AGziO3Z^9mg z7A?cIQSJkhZwXyBeNe;n?h(Y;te9piE<=Q|2uo{enU&)?MR#=z3#j@CMDU8G6vx!rb~XUEqA3fLFpKH$;IO?OTCK!YsJD;g=sJYl7-c zeuUDx?7OCyO;M4FC!huk>Jb0+6ZBEvW-Oliw}}5Kw1t%=0I6SbEokDUwZCv1lR4b& NHJrkc^1mqu{sZXKaRt)8Ff)nmSxA%dbf7K9$z(BWzmop(DiZ!WtZPX4XmvvEB4=|{N={hKGJ@Ck9b=cYj a28QVSVi$VaG)@CeV(@hJb6Mw<&;$URoHcd; literal 0 HcmV?d00001 diff --git a/logos/weather_icons/small_icons/03.png b/logos/weather_icons/small_icons/03.png new file mode 100644 index 0000000000000000000000000000000000000000..81012da11213abd8fdc5844860a2883383c6c5dc GIT binary patch literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^!a&T$$P6TN+`r!eQjEnx?oNz1PwLbIIh+L^k;M!Q z+(1>_!i)^F=12eq*#dk*T!Hle|NocXoPQU{Vk!yp3ugEqJyB^Zkf-kH;uumfCpjSj zh@Pb(4B>1LQE51o;Is{QvI~a7_`&wefUu45^rt zoRGkiz`%4ZKtNLJ)r$iMb{LtMG&E*jy>dZ-ZEdLc^frSvQCqW?GIzurWe{PU7{k3q b%z%Mm`guVnh1@QX^B6o`{an^LB{Ts5$+9(a literal 0 HcmV?d00001 diff --git a/logos/weather_icons/small_icons/09.png b/logos/weather_icons/small_icons/09.png new file mode 100644 index 0000000000000000000000000000000000000000..6711cf3b22f57f5211f610a3404c53fbbf44bf7c GIT binary patch literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^!a&T=#0(^>wPf}KDaPU;cPGZ1Cw1z99L@rd$YKTt zZlEe|VMc~ob0mO*JOMr-u0T3CIQakn{|qPp7uYTl1oBx*g8YIRfI^#f9Xfz~e@_?3 zkcv67CpPjPP!M2t5T2rzB&6l0ARX}F;-$+04>XlFM*MsHC`FosciLpV%J3FfGnuLz z6HU|GmxRV1l>07K`QUu_j8kkqDaFf^s(v$E`zvzGHegQx&}arvS3j3^P6%sI lprNtx_ydC$W+g`!hU42r&hNY3co1kFgQu&X%Q~loCID$HJ<9+9 literal 0 HcmV?d00001 diff --git a/logos/weather_icons/small_icons/11.png b/logos/weather_icons/small_icons/11.png new file mode 100644 index 0000000000000000000000000000000000000000..bcc74d268d601546e2387a6594400886895051df GIT binary patch literal 215 zcmeAS@N?(olHy`uVBq!ia0vp^!a&T=#0(^>wPf}KDaPU;cPGZ1Cw1z99L@rd$YKTt zZlEe|VMc~ob0mO*JOMr-u0T3CIQTyhykX!DSw9WPXDJEt3uXX{Y}R$?0P;gTT^vIy z=7^r!$a%nk$K~St4wHkEcYNYF$ELUD;wAPb?(D9H+dQI?GX0MQTDtD9^S-)Spe-wP zv$yogs{9!@HM|c`e_FWw`2Wv6?|MEdDW&{Sy7%$VqgK&e=F_WY1I=gfboFyt=akR{ E0CVt6M*si- literal 0 HcmV?d00001 diff --git a/logos/weather_icons/small_icons/13.png b/logos/weather_icons/small_icons/13.png new file mode 100644 index 0000000000000000000000000000000000000000..0143bf68a55a10f3fb03dc25a1494cf3647b43cb GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^{2KaRt&0xBh?LRDB)DU@8gn3ugEqJyB^Zkf-bE;uumfCpn=sAt5h8 zKqSGSH{n4@!VIY+5AGcL@L#@zWmBV)L*W9Q0N&Ni3KaRt)<|NmclbN*c*i>V~YFPPzf^hBktK%SDPi(^Q|oa7D349)Ti ui`MbDoRV%hAtf!KS;?UDiE+&nc7_UjcCKr=A`5}489ZJ6T-G@yGywqOsV3(D literal 0 HcmV?d00001 diff --git a/stockTicker.py b/stockTicker.py index fb1c463..3ae36a9 100644 --- a/stockTicker.py +++ b/stockTicker.py @@ -63,9 +63,16 @@ class StockTicker(): image = image.convert('RGB') return image + + def degreesToCompass(self, deg): + + dirs = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'] + + return dirs[int((deg+22.5)//45)%8] - def setImage(self, image, offset_x = 0, offset_y = 0, unsafe=False): + + def setImage(self, image, offset_x = 0, offset_y = 0, unsafe=False, min_x = 0, max_x = 128, min_y = 0, max_y = 32): if (image.mode != "RGB"): @@ -86,11 +93,12 @@ class StockTicker(): # C functions can certainly be faster. img_width, img_height = image.size pixels = image.load() - for x in range(max(0, -offset_x), min(img_width, self.matrix.width - offset_x)): + for x in range(max(0,-offset_x), min(img_width, self.matrix.width - offset_x)): + for y in range(max(0, -offset_y), min(img_height, self.matrix.height - offset_y)): (r, g, b) = pixels[x, y] - - self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness) + if min_x <= x + offset_x <= max_x and min_y <= y + offset_y <= max_y: + self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness) def scrollImage(self, image, offset_x = 0, offset_y = 0): img_width, img_height = image.size @@ -550,7 +558,8 @@ class StockTicker(): large_font = ImageFont.load("./fonts/10x20.pil") - location_img = self.textImage(location, small_font) + location_img = self.textImage(location, small_font, r = 255, g = 255, b = 0) + img.paste(location_img, (5,0)) @@ -566,10 +575,10 @@ class StockTicker(): weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png') img.paste(weather_img, (5,12)) - temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font) + temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font, r = 200, g = 0, b = 255) img.paste(temp_img, (50,9)) - deg_img = self.textImage('o', small_font) + deg_img = self.textImage('o', small_font, r = 200, g = 0, b = 255) print(temp_img.size) img.paste(deg_img, (70, 8)) @@ -577,7 +586,7 @@ class StockTicker(): main_img = self.textImage(main, small_font) img.paste(main_img, (45, 26)) - feels_img = self.textImage('Feels like:' + str("{0:.0f}".format(current_weather['feels_like'])), small_font) + feels_img = self.textImage('Feels like:' + str("{0:.0f}".format(current_weather['feels_like'])), small_font, r = 200, g = 0, b = 255) img.paste(feels_img, (41, 0)) min_img = self.textImage( "{0:.0f}".format(current_weather['min_temp']), small_font, r=0, g=0, b=255) @@ -593,10 +602,10 @@ class StockTicker(): img.paste(htext_img, (120, 10)) uv_img = Image.open(weather_dir + '/uv.png') - img.paste(uv_img, ( 109, 20)) + img.paste(uv_img, ( 107, 20)) utext_img = self.textImage(str(current_weather['uv']) , small_font) - img.paste(utext_img, (120, 23)) + img.paste(utext_img, (118, 23)) weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] months =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] @@ -608,14 +617,14 @@ class StockTicker(): - date_img = self.textImage(month + ' ' + date + ', ' + weekday, small_font) + date_img = self.textImage(month + ' ' + date + ',' + weekday, small_font) img.paste(date_img, (132, 0)) rain_img = Image.open(weather_dir + '/rain-chance.png') img.paste(rain_img, (143,8)) - rtext_img = self.textImage(str(current_weather['clouds']) + '%', small_font) + rtext_img = self.textImage(str(current_weather['rain_chance']) + '%', small_font) img.paste(rtext_img, (156, 10)) cloud_img = Image.open(weather_dir + '/clouds.png') @@ -625,58 +634,141 @@ class StockTicker(): img.paste(ctext_img, (156, 22)) wind_img = Image.open(weather_dir + '/wind.png') - img.paste(wind_img, (177,8)) + img.paste(wind_img, (179,8)) - wtext_img = self.textImage(str(current_weather['wind_speed']) + 'm/s', small_font) - img.paste(wtext_img, (190, 10)) + wtext_img = self.textImage("{0:.0f}".format(current_weather['wind_speed']) + 'm/s', small_font) + img.paste(wtext_img, (192, 10)) + + wdir_img = self.textImage(self.degreesToCompass(current_weather['wind_direction']), small_font) + img.paste(wdir_img, (212, 10)) vis_img = Image.open(weather_dir + '/visibility.png') - img.paste(vis_img, (177,20)) + img.paste(vis_img, (179,20)) vtext_img = self.textImage(str(current_weather['visibility']/1000) + 'km', small_font) - img.paste(vtext_img, (190, 22)) + img.paste(vtext_img, (192, 22)) + + return img def getDailyWeatherImage(self): + + location = 'London' - img = Image.new('RGB', (1000, 32)) + img = Image.new('RGB', (128, 32)) - - daily_weather = json.load(open('csv/daily_weather.json', 'r')) + current_weather = json.load(open('csv/current_weather.json', 'r')) small_font = ImageFont.load("./fonts/5x7.pil") + extra_small_font = ImageFont.load("./fonts/4x6.pil") large_font = ImageFont.load("./fonts/10x20.pil") - location_img = self.textImage(location, small_font) + location_img = self.textImage(location, small_font, r = 255, g = 255, b = 0) - #img.paste(location_img, (20,0)) + + + main = current_weather['main_weather'] + if main == 'Clouds': + main = current_weather['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'} + + weather_dir = './logos/weather_icons' + + weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png') + + + temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font) + + + deg_img = self.textImage('o', small_font) + + min_img = self.textImage( "{0:.0f}".format(current_weather['min_temp']), small_font, r=0, g=0, b=255) + + + max_img = self.textImage( "{0:.0f}".format(current_weather['max_temp']), small_font, r=255, g=0, b=0) + + + main = current_weather['main_weather'] + main_img = self.textImage(main, small_font) weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] months =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] month = months[int(datetime.now().strftime('%m'))] date = str(int(datetime.now().strftime('%d'))) - weekday = weekdays[datetime.today().weekday()] + date_img = self.textImage(month + ' ' + date + ',' + weekday, extra_small_font) + + rain_img = Image.open(weather_dir + '/rain-chance.png') - date_img = self.textImage(month + ' ' + date + ', ' + weekday, small_font) + + rtext_img = self.textImage(str(current_weather['rain_chance']) + '%', extra_small_font) + + + hum_img = Image.open(weather_dir + '/humidity.png') + + + htext_img = self.textImage(str(current_weather['humidity']) + '%', extra_small_font) + + + uv_img = Image.open(weather_dir + '/uv.png') + + + utext_img = self.textImage(str(current_weather['uv']) , extra_small_font) + + wind_img = Image.open(weather_dir + '/wind.png') + + wtext_img = self.textImage(str(current_weather['wind_speed']) + 'm/s', extra_small_font) + + print(temp_img.size) + img.paste(location_img, (0,0)) + img.paste(weather_img, (0,12)) + img.paste(temp_img, (30,9)) + img.paste(deg_img, (50, 8)) + img.paste(min_img, (56, 10)) + img.paste(main_img, (30, 26)) + img.paste(max_img, (56, 20)) + img.paste(date_img, (location_img.size[0], 1)) + + + img.paste(rain_img, (75,0)) + img.paste(rtext_img, (88, 1)) + img.paste(hum_img, (102, 0)) + img.paste(htext_img, (113, 1)) + + #img.paste(uv_img, ( 96, 0)) + #img.paste(utext_img, (109, 0)) + #img.paste(wind_img, (96,0)) + #img.paste(wtext_img, (109,0)) + + + + img0 = img + + img = Image.new('RGB', (1000, 32)) + + + + + daily_weather = json.load(open('csv/daily_weather.json', 'r')) + #img.paste(date_img, (70, 0)) + + x_offset = 64 + + for i in range(0,len(daily_weather)-1): + - print(len(daily_weather)) - weather_dir = './logos/weather_icons' - - 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'} - - x_offset = 4 - - for i in range(len(daily_weather)): + weekday = weekdays[(datetime.today().weekday() + i)%7] + + day_img = self.textImage( weekday, small_font) weather = daily_weather[i] main = weather['main_weather'] @@ -684,21 +776,24 @@ class StockTicker(): if main == 'Clouds': main = weather['description'] - weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png') + weather_img = Image.open(weather_dir + '/small_icons/' + weather_ids[main] + '.png') min_img = self.textImage( "{0:.0f}".format(weather['min_temp']), small_font, r=0, g=0, b=255) max_img = self.textImage( "{0:.0f}".format(weather['max_temp']), small_font, r=255, g=0, b=0) - img.paste(weather_img, (x_offset, 0)) - img.paste(min_img, (x_offset, 26)) - img.paste(max_img, (x_offset + 12, 26)) + img.paste(day_img, (x_offset +5, 9)) + img.paste(weather_img, (x_offset +5, 16)) + img.paste(min_img, (x_offset + 25, 10)) + img.paste(max_img, (x_offset + 25, 21)) - x_offset += weather_img.size[0] + 5 + x_offset += 35 - img = img.crop((0,0,x_offset,32)) + img1 = img.crop((64,0,x_offset ,32)) - return img + img1.save('weather.ppm') + + return img0, img1 #Send the final stitched image to the display for set amount of time def displayStocks(self): @@ -779,6 +874,48 @@ class StockTicker(): self.running = False print('MATRIX DISPLAY STOP CALLED') + def displayDailyWeather(self): + img0, img1 = self.getDailyWeatherImage() + #img = stock_ticker.getTodayWeatherImage() + + + while True: + + self.setImage(img0, offset_x = 0, offset_y = 0) + image = img1 + + img_width, img_height = image.size + + offset_x = 64 + offset_y = 0 + + while offset_x > 64-img_width: + offset_x -= 1 + + + self.setImage(image, offset_x = offset_x, offset_y = offset_y, min_x = 64, min_y = 9) + if offset_x + img_width < self.matrix.width: # if the image is ending + self.setImage(image, offset_x = offset_x + img_width, offset_y = offset_y, min_x = 64, min_y = 9) + + + + + try: + msg = getInput() + if msg == 'K': + self.resetMatrix() + return True + + + self.process_msg(msg) + except KeyboardInterrupt: + sys.stdout.flush() + pass + + time.sleep(self.delay) + + + def process_msg(self, msg): if msg == 'S': # stocks @@ -829,12 +966,10 @@ class StockTicker(): elif msg == 'W': # weather img = stock_ticker.getTodayWeatherImage() img.save('weather.ppm') - self.scrollImageTransition(['weather.ppm', 'weather.ppm']) + self.scrollImageTransition(['weather.ppm', 'weather.ppm'], stocks = False) elif msg == 'D': # daily weather - img = stock_ticker.getDailyWeatherImage() - img.save('weather.ppm') - self.scrollImageTransition(['weather.ppm', 'weather.ppm']) + self.displayDailyWeather() elif msg == 'K': # kill self.resetMatrix() @@ -848,12 +983,18 @@ if __name__ == '__main__': - #img = stock_ticker.getDailyWeatherImage() + #img0, img1 = stock_ticker.getDailyWeatherImage() #img = stock_ticker.getTodayWeatherImage() #img.save('weather.ppm') - #stock_ticker.scrollImageTransition(['weather.ppm', 'weather.ppm']) + #stock_ticker.process_msg('S') + #stock_ticker.process_msg('W') + #stock_ticker.displayDailyWeather() + #stock_ticker.delay = 10 + #stock_ticker.scrollImageTransition(['weather.ppm', 'weather.ppm'], stocks = False) + + #stock_ticker.process_msg('G') #stock_ticker.scrollImageTransition([os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_image'), os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_image')], stocks = False) diff --git a/weather.ppm b/weather.ppm index 10e6efc164cfd13f191ebcb9a41e9a93ab4eb450..da0ff7f95690d26cb4f6616904d50a4ae58c0c85 100755 GIT binary patch literal 21614 zcmeHK%XJ$^5X6~LI0ov`A?WDm6qJh&3c?46qoWc~EO229TdeJ#8SG~kgo&Mp2UJ&A zchAh$1IWMse0hC+`{T>&%j?_Q%W1mK=V?4IT37Y+bk=Lm9E#^Cp~+$}tQDBqirpm6 zot5eZ&Xo%VUrS;1oNS}K*XH-`Q@NWPW7kz}w91V=4K6KeZq5xR^iZ_|#St6HhLLJ1 z@d9}djZ_vtER)R!MkKL9oFXs`dAg9wN9LpVXH7=R5Q5KQXH-bwDQ`u-mgN-B`dsk> zVQ80-UXr5((A;sDg;XQ!wURjy4s9PTbo&j5x^9rXvMa)T((sfS;#~kG3R%un=5upu zoUhetoCID)>?vTrvaApEB{s{@2xJw8- z=`|kb!U$(Tz4(Us+GYHZNk-y^OX(a|IaaxYAn=eKAa)>3K8IoegneQc9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