gif and sports titles added

This commit is contained in:
Neythen 2021-08-03 18:16:13 +01:00
parent 32dd757588
commit 5867b862c6
15 changed files with 67 additions and 63 deletions

View File

@ -1,4 +1,4 @@
symbol,name,base,current,24hr change symbol,name,base,current,24hr change
BTC,bitcoin,usd,41608,7.5637268829287105 BTC,bitcoin,usd,38562,-3.1527074759072398
ETH,ethereum,gbp,1767.07,4.946057229445047 ETH,ethereum,gbp,1804.79,-5.029820064487153
DOGE,dogecoin,usd,0.209425,3.0856074912371008 DOGE,dogecoin,usd,0.198365,-3.4809067470776904

1 symbol name base current 24hr change
2 BTC bitcoin usd 41608 38562 7.5637268829287105 -3.1527074759072398
3 ETH ethereum gbp 1767.07 1804.79 4.946057229445047 -5.029820064487153
4 DOGE dogecoin usd 0.209425 0.198365 3.0856074912371008 -3.4809067470776904

View File

@ -1 +1 @@
["USD", {"AUD": [1.362, 1.3572], "CAD": [1.2569, 1.2565], "CHF": [0.91488, 0.91499], "EUR": [0.84696, 0.84674], "GBP": [0.72072, 0.72399], "JPY": [110.08, 110.06], "NZD": [1.4409, 1.4357]}] ["USD", {"AUD": [1.3535, 1.358], "CAD": [1.2515, 1.2465], "CHF": [0.90324, 0.90535], "EUR": [0.8414, 0.84133], "GBP": [0.71817, 0.71991], "JPY": [109.13, 109.52], "NZD": [1.4264, 1.4337]}]

View File

@ -1 +1 @@
[{"main_weather": "Clouds", "description": "overcast clouds", "temp": 29.14, "min_temp": 28.1, "max_temp": 29.92, "feels_like": 36.14, "humidity": 90, "clouds": 96, "wind_speed": 0.45, "wind_direction": 90, "visibility": 10000, "uv": 0, "rain_chance": 0}, {"main_weather": "Clouds", "description": "scattered clouds", "temp": 21.34, "min_temp": 12.35, "max_temp": 21.56, "feels_like": 20.91, "humidity": 53, "clouds": 28, "wind_speed": 6.69, "wind_direction": 260, "visibility": 10000, "uv": 2.93, "rain_chance": 0}] [{"main_weather": "Clouds", "description": "broken clouds", "temp": 27.33, "min_temp": 26.86, "max_temp": 29.57, "feels_like": 31.44, "humidity": 88, "clouds": 70, "wind_speed": 4.92, "wind_direction": 40, "visibility": 10000, "uv": 0, "rain_chance": 0.82}, {"main_weather": "Clouds", "description": "overcast clouds", "temp": 19.25, "min_temp": 13.89, "max_temp": 20.27, "feels_like": 19.01, "humidity": 68, "clouds": 94, "wind_speed": 4.63, "wind_direction": 130, "visibility": 10000, "uv": 1.06, "rain_chance": 0.56}]

View File

@ -1 +1 @@
[[{"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.1, "max_temp": 29.92}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.42, "max_temp": 29.19}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.53, "max_temp": 30.07}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.35, "max_temp": 29.88}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.43, "max_temp": 28.64}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.31, "max_temp": 29.18}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.32, "max_temp": 31.55}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.18, "max_temp": 32.05}], [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 12.35, "max_temp": 21.56}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.31, "max_temp": 18.5}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.38, "max_temp": 20.87}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.75, "max_temp": 20.42}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.39, "max_temp": 20.32}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15.16, "max_temp": 21.32}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.99, "max_temp": 21.43}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.34, "max_temp": 21.38}]] [[{"main_weather": "Rain", "description": "moderate rain", "min_temp": 26.86, "max_temp": 29.57}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 26.72, "max_temp": 28.32}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 26.03, "max_temp": 27.98}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.2, "max_temp": 28.08}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.91, "max_temp": 28.84}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.18, "max_temp": 29.87}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.09, "max_temp": 29.25}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.23, "max_temp": 29.96}], [{"main_weather": "Rain", "description": "light rain", "min_temp": 13.89, "max_temp": 20.27}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.12, "max_temp": 22.97}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.54, "max_temp": 21.04}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15, "max_temp": 19.8}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.95, "max_temp": 19.15}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.39, "max_temp": 19.7}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.31, "max_temp": 22.84}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 15.14, "max_temp": 23.12}]]

View File

@ -1 +1 @@
{"stocks": "31/07/2021 05:57:19", "crypto": "31/07/2021 05:57:20", "news": "31/07/2021 05:57:21", "weather": "31/07/2021 05:57:20", "forex": "31/07/2021 11:57:24", "sports": "31/07/2021 05:57:21"} {"stocks": "03/08/2021 13:14:11", "crypto": "03/08/2021 13:14:13", "news": "03/08/2021 13:14:15", "weather": "03/08/2021 13:14:14", "forex": "03/08/2021 19:14:18", "sports": "03/08/2021 13:14:16"}

View File

@ -1,21 +1,21 @@
headline,source,date,time headline,source,date,time
Coronavirus live: UK businesses warned over no jab no job policies^ Germany anti-lockdown protests banned - The Guardian,The Guardian,2021-07-31,08:39:03Z Pentagon on lockdown after gunshots fired near Metro station - Daily Mail,Daily Mail,2021-08-03,16:26:56Z
Live: Tokyo Olympics^ day eight: Great Britain and Fiji fight for bronze ahead of Black Ferns' gold medal bid - Stuff.co.nz,Stuff.co.nz,2021-07-31,08:29:00Z Andrew Cuomo: New York Governor sexually harassed women^ report finds - BBC News,BBC News,2021-08-03,16:14:54Z
Basketball-Nigeria's Metu blasts government for lack of support at Games - Reuters,Reuters,2021-07-31,08:24:00Z New York Gov. Andrew Cuomo sexually harassed multiple women^ state attorney general report says - CNN,CNN,2021-08-03,16:13:00Z
Image: Hubble spots squabbling galactic siblings - Phys.org,Phys.Org,2021-07-31,08:17:09Z Vaccinated people are much more protected from COVID-19 than unvaccinated individuals; the benefits of the COVID-19 vaccines outweigh their risks - Health Feedback,Health Feedback,2021-08-03,16:08:36Z
Mi 12 Tipped to Integrate Newly Announced LPDDR5X RAM^ Could Come With Snapdragon 898 SoC - Gadgets 360,NDTV News,2021-07-31,08:08:21Z Coronavirus live updates: Quebec reports 175 new cases^ no deaths - Montreal Gazette,Montreal Gazette,2021-08-03,16:06:05Z
Tokyo 2020 Day 8: Regrets for Mark English in 800m; golf hots up as McIlroy hunts a medal - The Irish Times,The Irish Times,2021-07-31,08:03:45Z Index surges anew ahead of Q2 earnings - Philstar.com,Philippine Star,2021-08-03,16:00:00Z
JUST IN: Nollywood actress Racheal Oniga is dead - P.M. News,P.M. News,2021-07-31,08:03:45Z Matt Damons New Statement Saying He Doesnt “Use Slurs Of Any Kind” After “Retiring The F-Slur” Has Sparked A Huge Debate In Light Of Him Playing Gay Characters In The Past - BuzzFeed News,BuzzFeed News,2021-08-03,15:55:00Z
DOH lists 8^147 new COVID-19 cases^ 167 more deaths - CNN Philippines,CNN Philippines,2021-07-31,08:01:47Z Pentagon reopens after brief lockdown due to shooting near Metro station - Hindustan Times,Hindustan Times,2021-08-03,15:51:14Z
Team GB smash world record to win Tokyo 4x100m mixed medley relay gold - The Guardian,The Guardian,2021-07-31,08:00:00Z Massive Balloon the Size of a Soccer Stadium to Launch Telescope to Edge of Space to Study How Stars Form - Good News Network,Good News Network,2021-08-03,15:51:01Z
Bright reflections observed at Mars south pole may be clay^ not water - Tech Explorist,Tech Explorist,2021-07-31,07:58:33Z Todays coronavirus news: Ontario reporting 164 cases Tuesday^ 168 cases Monday; NYC to require vaccination proof for indoor dining^ gyms - Toronto Star,Toronto Star,2021-08-03,15:45:00Z
Huge Chunk Of Road Caves In Under Flyover In South Delhi^ Stops Traffic - NDTV,NDTV News,2021-07-31,07:57:33Z NBA free agency Day 1 winners and losers: Heat make power moves; Lakers defense takes hit; Knicks go sideways - CBS Sports,CBS Sports,2021-08-03,15:45:00Z
Business groups seek clarity on regulations as emergency ordinances in limbo - Malaysiakini,Malaysiakini,2021-07-31,07:54:00Z Covid 19 coronavirus: China orders mass testing in Wuhan as outbreak spreads - New Zealand Herald,New Zealand Herald,2021-08-03,15:35:31Z
Tokyo Olympics live: OlyWhites captain Winston Reid recovers from injury to face Japan - Stuff.co.nz,Stuff.co.nz,2021-07-31,07:53:00Z Celtic sign goalkeeper Joe Hart and midfielder James McCarthy - Sky Sports,Sky Sports,2021-08-03,15:33:55Z
Sailing: Kimberly Lim and Cecilia Low finish 10th overall^ first Singaporeans to qualify for medal race at Olympics - CNA,CNA,2021-07-31,07:48:46Z At least 3 injured in workplace shooting at SmileDirectClub in Antioch^ Tennessee - NBC News,NBC News,2021-08-03,15:32:02Z
Google will stop account sign-in for users running these old Android versions - Times of India,The Times of India,2021-07-31,07:48:00Z #UnrestSA: State wants to adds treason charges to lawyer Ike Khumalo's incitement case - News24,News24,2021-08-03,15:27:28Z
UPDATED: Blessing Okagbare suspended from athletics hours to Olympics 100m semi-final race - Premium Times,Premium Times,2021-07-31,07:42:56Z Boeing delays key uncrewed test flight of Starliner capsule to space station - The Straits Times,The Straits Times,2021-08-03,15:21:41Z
India records 41^649 new Covid cases; active cases rise for 4th day - The Indian Express,The Indian Express,2021-07-31,07:39:37Z Florida's Broward County school district reverses its mask mandate after funding threat from the governor - CNN,CNN,2021-08-03,15:21:00Z
Home Office set up fake website to deter asylum seekers from crossing Channel with misleading claims - The Independent,Independent,2021-07-31,07:35:09Z U.S. Gov. Cuomo sexually harassed multiple women^ probe finds - CTV News,Ctvnews.ca,2021-08-03,15:18:39Z
Assam-Mizoram border dispute LIVE Updates: Tensions rise as Mizoram names CM Himanta Biswa Sarma in violence FIR - The Indian Express,The Indian Express,2021-07-31,07:29:22Z COVID-19: UK records another 138 coronavirus deaths - the highest daily total since 17 March - Sky News,Sky.com,2021-08-03,15:17:28Z
PV Sindhu Semi-Final LIVE: Sindhu can create history today by becoming 1st Indian sportsperson to play two Olympic Finals in individual sports - InsideSport,InsideSport,2021-07-31,07:26:11Z Tokyo Olympics: PV Sindhu^ India's Double Olympic Medallist^ Felicitated After Returning From Tokyo | Olympics News - NDTVSports.com,NDTV News,2021-08-03,15:17:00Z

1 headline source date time
2 Coronavirus live: UK businesses warned over ‘no jab no job’ policies^ Germany anti-lockdown protests banned - The Guardian Pentagon on lockdown after gunshots fired near Metro station - Daily Mail The Guardian Daily Mail 2021-07-31 2021-08-03 08:39:03Z 16:26:56Z
3 Live: Tokyo Olympics^ day eight: Great Britain and Fiji fight for bronze ahead of Black Ferns' gold medal bid - Stuff.co.nz Andrew Cuomo: New York Governor sexually harassed women^ report finds - BBC News Stuff.co.nz BBC News 2021-07-31 2021-08-03 08:29:00Z 16:14:54Z
4 Basketball-Nigeria's Metu blasts government for lack of support at Games - Reuters New York Gov. Andrew Cuomo sexually harassed multiple women^ state attorney general report says - CNN Reuters CNN 2021-07-31 2021-08-03 08:24:00Z 16:13:00Z
5 Image: Hubble spots squabbling galactic siblings - Phys.org Vaccinated people are much more protected from COVID-19 than unvaccinated individuals; the benefits of the COVID-19 vaccines outweigh their risks - Health Feedback Phys.Org Health Feedback 2021-07-31 2021-08-03 08:17:09Z 16:08:36Z
6 Mi 12 Tipped to Integrate Newly Announced LPDDR5X RAM^ Could Come With Snapdragon 898 SoC - Gadgets 360 Coronavirus live updates: Quebec reports 175 new cases^ no deaths - Montreal Gazette NDTV News Montreal Gazette 2021-07-31 2021-08-03 08:08:21Z 16:06:05Z
7 Tokyo 2020 Day 8: Regrets for Mark English in 800m; golf hots up as McIlroy hunts a medal - The Irish Times Index surges anew ahead of Q2 earnings - Philstar.com The Irish Times Philippine Star 2021-07-31 2021-08-03 08:03:45Z 16:00:00Z
8 JUST IN: Nollywood actress Racheal Oniga is dead - P.M. News Matt Damon’s New Statement Saying He Doesn’t “Use Slurs Of Any Kind” After “Retiring The F-Slur” Has Sparked A Huge Debate In Light Of Him Playing Gay Characters In The Past - BuzzFeed News P.M. News BuzzFeed News 2021-07-31 2021-08-03 08:03:45Z 15:55:00Z
9 DOH lists 8^147 new COVID-19 cases^ 167 more deaths - CNN Philippines Pentagon reopens after brief lockdown due to shooting near Metro station - Hindustan Times CNN Philippines Hindustan Times 2021-07-31 2021-08-03 08:01:47Z 15:51:14Z
10 Team GB smash world record to win Tokyo 4x100m mixed medley relay gold - The Guardian Massive Balloon the Size of a Soccer Stadium to Launch Telescope to Edge of Space to Study How Stars Form - Good News Network The Guardian Good News Network 2021-07-31 2021-08-03 08:00:00Z 15:51:01Z
11 Bright reflections observed at Mars’ south pole may be clay^ not water - Tech Explorist Today’s coronavirus news: Ontario reporting 164 cases Tuesday^ 168 cases Monday; NYC to require vaccination proof for indoor dining^ gyms - Toronto Star Tech Explorist Toronto Star 2021-07-31 2021-08-03 07:58:33Z 15:45:00Z
12 Huge Chunk Of Road Caves In Under Flyover In South Delhi^ Stops Traffic - NDTV NBA free agency Day 1 winners and losers: Heat make power moves; Lakers defense takes hit; Knicks go sideways - CBS Sports NDTV News CBS Sports 2021-07-31 2021-08-03 07:57:33Z 15:45:00Z
13 Business groups seek clarity on regulations as emergency ordinances in limbo - Malaysiakini Covid 19 coronavirus: China orders mass testing in Wuhan as outbreak spreads - New Zealand Herald Malaysiakini New Zealand Herald 2021-07-31 2021-08-03 07:54:00Z 15:35:31Z
14 Tokyo Olympics live: OlyWhites captain Winston Reid recovers from injury to face Japan - Stuff.co.nz Celtic sign goalkeeper Joe Hart and midfielder James McCarthy - Sky Sports Stuff.co.nz Sky Sports 2021-07-31 2021-08-03 07:53:00Z 15:33:55Z
15 Sailing: Kimberly Lim and Cecilia Low finish 10th overall^ first Singaporeans to qualify for medal race at Olympics - CNA At least 3 injured in workplace shooting at SmileDirectClub in Antioch^ Tennessee - NBC News CNA NBC News 2021-07-31 2021-08-03 07:48:46Z 15:32:02Z
16 Google will stop account sign-in for users running these old Android versions - Times of India #UnrestSA: State wants to adds treason charges to lawyer Ike Khumalo's incitement case - News24 The Times of India News24 2021-07-31 2021-08-03 07:48:00Z 15:27:28Z
17 UPDATED: Blessing Okagbare suspended from athletics hours to Olympics 100m semi-final race - Premium Times Boeing delays key uncrewed test flight of Starliner capsule to space station - The Straits Times Premium Times The Straits Times 2021-07-31 2021-08-03 07:42:56Z 15:21:41Z
18 India records 41^649 new Covid cases; active cases rise for 4th day - The Indian Express Florida's Broward County school district reverses its mask mandate after funding threat from the governor - CNN The Indian Express CNN 2021-07-31 2021-08-03 07:39:37Z 15:21:00Z
19 Home Office set up fake website to deter asylum seekers from crossing Channel with ‘misleading’ claims - The Independent U.S. Gov. Cuomo sexually harassed multiple women^ probe finds - CTV News Independent Ctvnews.ca 2021-07-31 2021-08-03 07:35:09Z 15:18:39Z
20 Assam-Mizoram border dispute LIVE Updates: Tensions rise as Mizoram names CM Himanta Biswa Sarma in violence FIR - The Indian Express COVID-19: UK records another 138 coronavirus deaths - the highest daily total since 17 March - Sky News The Indian Express Sky.com 2021-07-31 2021-08-03 07:29:22Z 15:17:28Z
21 PV Sindhu Semi-Final LIVE: Sindhu can create history today by becoming 1st Indian sportsperson to play two Olympic Finals in individual sports - InsideSport Tokyo Olympics: PV Sindhu^ India's Double Olympic Medallist^ Felicitated After Returning From Tokyo | Olympics News - NDTVSports.com InsideSport NDTV News 2021-07-31 2021-08-03 07:26:11Z 15:17:00Z

View File

@ -1,4 +1,4 @@
name,current,opening name,current,opening
MSFT,288.51,286.19 MSFT,286.9,285.605
NFLX,520.495,521.015 NFLX,510.84,514.24
GOOG,2732.56,2728.535 GOOG,2720.7,2721.21

1 name current opening
2 MSFT 288.51 286.9 286.19 285.605
3 NFLX 520.495 510.84 521.015 514.24
4 GOOG 2732.56 2720.7 2728.535 2721.21

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 821 B

View File

@ -9,7 +9,7 @@
import sys, select import sys, select
import os import os
import threading import threading
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont, ImageSequence
Image.init() Image.init()
@ -57,13 +57,16 @@ class StockTicker():
options.gpio_slowdown = 4 options.gpio_slowdown = 4
self.matrix = RGBMatrix(options = options) self.matrix = RGBMatrix(options = options)
self.points = True # display crypto change in points or percent self.points = True # display crypto change in points or percent
self.functions = {'stocks': self.getStockImage, 'crypto': self.getCryptoImage, 'forex': self.getForexImage, self.functions = {'stocks': self.getStockImage, 'crypto': self.getCryptoImage, 'forex': self.getForexImage,
'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getTodayWeatherImage, 'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getTodayWeatherImage,
'league_table': self.getLeagueTableImage, 'league_games': self.getLeagueImage, 'news':self.getNewsImage, 'league_table':lambda : self.getLeagueTableImage('premier_league'), 'past_games': lambda:self.getLeagueImage('NBA', 'past'),
'text': self.getUserText, 'display_image': self.getUserImage, 'display_gif':self.getUserGIF, 'future_games': lambda : self.getLeagueImage('NHL', 'future'), 'live_games': lambda: self.getLeagueImage('NBA', 'live'),
'news':self.getNewsImage, 'text': self.getUserText, 'display_image': self.getUserImage, 'display_gif':self.getUserGIF,
'stocks_prof': self.getStockProfessional, 'crypto_prof': self.getCryptoProfessional, 'forex_prof': self.getForexProfessional, 'stocks_prof': self.getStockProfessional, 'crypto_prof': self.getCryptoProfessional, 'forex_prof': self.getForexProfessional,
'today_weather_prof': self.getTodayWeatherProfessional, 'news_prof':self.getNewsProfessional} #put this somewhere else 'today_weather_prof': self.getTodayWeatherProfessional, 'news_prof':self.getNewsProfessional}
def openImage(self, image_file): def openImage(self, image_file):
@ -271,9 +274,9 @@ class StockTicker():
def updateMultiple(self, options): def updateMultiple(self, options):
for option in options: for option in options:
img = self.functions[option]()
if option not in ['display_gif']: # aving the gif like this kills the animation if option not in ['display_gif']: # aving the gif like this kills the animation
img = self.functions[option]()
img.save('./display_images/'+ option+ '.ppm') img.save('./display_images/'+ option+ '.ppm')
def incrementGIF(self, image): def incrementGIF(self, image):
@ -319,7 +322,7 @@ class StockTicker():
image = self.openImage('./display_images/' + options[i % len(options)] +'.ppm') image = self.openImage('./display_images/' + options[i % len(options)] +'.ppm')
image = image.convert('RGB') image = image.convert('RGB')
else: else:
image = self.openImage('./display_images/user_gif.gif') image = self.openImage('./display_images/display_gif.gif')
img_width, img_height = image.size img_width, img_height = image.size
@ -1082,6 +1085,8 @@ class StockTicker():
league = f.read().replace('\n', '') league = f.read().replace('\n', '')
f.close() f.close()
title_img = self.openImage('feature_titles/sports_'+ time + '.png')
img = Image.new('RGB', (10000, 32)) img = Image.new('RGB', (10000, 32))
league_info = json.load(open('csv/sports/{}/{}_games.json'.format(league, time), 'r')) league_info = json.load(open('csv/sports/{}/{}_games.json'.format(league, time), 'r'))
@ -1204,8 +1209,8 @@ class StockTicker():
x_offset += buff_size x_offset += buff_size
img = img.crop((0,0,x_offset ,32)) img = img.crop((0,0,x_offset ,32))
font = ImageFont.load("./fonts/texgyre-27.pil")
title_img = self.textImage(time.upper() + ' GAMES', font, matrix_height = True)
return self.stitchImage([title_img, img]) return self.stitchImage([title_img, img])
@ -1216,6 +1221,10 @@ class StockTicker():
f = open( "csv/table_league.txt", 'r' ) f = open( "csv/table_league.txt", 'r' )
league = f.read().replace('\n', '') league = f.read().replace('\n', '')
f.close() f.close()
title_img = self.openImage('feature_titles/sports_team_stats.png')
img = Image.new('RGB', (10000, 32)) img = Image.new('RGB', (10000, 32))
team_info = json.load(open('csv/sports/{}/team_stats.json'.format(league), 'r')) team_info = json.load(open('csv/sports/{}/team_stats.json'.format(league), 'r'))
@ -1266,9 +1275,6 @@ class StockTicker():
img = img.crop((0,0,x_offset ,32)) img = img.crop((0,0,x_offset ,32))
font = ImageFont.load("./fonts/texgyre-27.pil")
title_img = self.textImage('LEAGUE TABLE', font, matrix_height = True)
return self.stitchImage([title_img, img]) return self.stitchImage([title_img, img])
def getTodayWeatherImage(self): def getTodayWeatherImage(self):
@ -1887,9 +1893,20 @@ class StockTicker():
return self.stitchImage([title_img, image]) return self.stitchImage([title_img, image])
def getUserGIF(self): def getUserGIF(self):
title_img = self.openImage('feature_titles/gifs.png')
gif = Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/user_gif.gif')) gif = Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/user_gif.gif'))
return gif
frames = []
for i, frame in enumerate(ImageSequence.Iterator(gif)):
f = self.stitchImage([title_img, frame])
frames.append(f)
frames[0].save('./display_images/display_gif.gif', save_all=True, append_images=frames[1:], loop=0, optimize = False)
return None
def displayStocks(self): def displayStocks(self):
@ -1959,8 +1976,7 @@ class StockTicker():
self.scrollFunctionsAnimated(['display_image', 'display_image'], animation = 'traditional') self.scrollFunctionsAnimated(['display_image', 'display_image'], animation = 'traditional')
elif msg == 'G': # gif elif msg == 'G': # gif
image = self.openImage('./display_images/user_gif.gif')
#self.displayGIF(image)
self.scrollFunctionsAnimated(['display_gif', 'display_gif'], animation = 'traditional') self.scrollFunctionsAnimated(['display_gif', 'display_gif'], animation = 'traditional')
elif msg == 'W': # weather elif msg == 'W': # weather
@ -1970,28 +1986,16 @@ class StockTicker():
self.scrollFunctionsAnimated(['daily_weather', 'daily_weather'],animation = 'traditional') self.scrollFunctionsAnimated(['daily_weather', 'daily_weather'],animation = 'traditional')
elif msg == 'P': # past league elif msg == 'P': # past league
img = self.getLeagueImage('NBA', 'past') self.scrollFunctionsAnimated(['past_games', 'past_games'],animation = 'traditional')
img.save('display_images/league.ppm')
stock_ticker.scrollImageTransition(['display_images/league.ppm', 'display_images/league.ppm'], stocks = False)
elif msg == 'l': # future league elif msg == 'l': # future league
img = self.getLeagueImage('NHL', 'future') self.scrollFunctionsAnimated(['future_games', 'future_games'],animation = 'traditional')
img.save('display_images/league.ppm')
stock_ticker.scrollImageTransition(['display_images/league.ppm', 'display_images/league.ppm'], stocks = False)
elif msg == 'L': # live game elif msg == 'L': # live game
img = self.getLeagueImage('NBA', 'live') self.scrollFunctionsAnimated(['live_games', 'live_games'],animation = 'traditional')
img.save('display_images/league.ppm')
stock_ticker.scrollImageTransition(['display_images/league.ppm', 'display_images/league.ppm'], stocks = False)
elif msg == 't': #legue tble elif msg == 't': #legue tble
img = self.getLeagueTableImage('premier_league') self.scrollFunctionsAnimated(['league_table', 'league_table'],animation = 'traditional')
img.save('display_images/teams.ppm')
stock_ticker.scrollImageTransition(['display_images/teams.ppm', 'display_images/teams.ppm'], stocks = False)
elif msg == 'A': #everything elif msg == 'A': #everything
@ -2027,7 +2031,7 @@ if __name__ == '__main__':
# #
#stock_ticker.process_msg('b') #stock_ticker.process_msg('G')
#stock_ticker.process_msg('G') #stock_ticker.process_msg('G')
#stock_ticker.process_msg('f') #stock_ticker.process_msg('f')
#stock_ticker.process_msg('W') #stock_ticker.process_msg('W')