first premier league stuff added

This commit is contained in:
Neythen 2021-06-15 19:35:04 +01:00
parent 2d357d9563
commit 29f3f736af
13 changed files with 185 additions and 100 deletions

View File

@ -298,7 +298,7 @@ def updateCurrencies(api_key):
json.dump([base, c_dict], open( "csv/currency.json", 'w+' ))
def updateSports():
def updateSports(api_key):
url = 'https://www.thesportsdb.com/api/v1/json/1/lookuptable.php?l=4328&s=2020-2021' # premier league table
'https://www.thesportsdb.com/api/v1/json/1/eventsnext.php?id=133602' # next five events by team ID (paid) use this for upcoming team games
'https://www.thesportsdb.com/api/v2/json/APIKEY/livescore.php?l=4380' #live scores
@ -397,6 +397,7 @@ if __name__ == '__main__':
weather_key = 'bd5d5096a5ba30bbcfb57ead42ab3fee'
currency_key = '862dbb6d1101ce0c5136'
sports_key = '97436974'
updateCurrencies(currency_key)
@ -426,7 +427,7 @@ if __name__ == '__main__':
updateCurrencies(currency_key)
updateNews()
updateWeather(weather_location, weather_key)
updateSports()
updateSports(sports_key)
NY_time = datetime.now(NY_zone)
symbols, stock_info = readCSV('csv/tickers.csv', max_stocks)

View File

@ -1,3 +1,3 @@
symbol,name,base,current,24hr change
BTC,bitcoin,usd,36800,1.9889872710237515
ETH,ethereum,gbp,1747.56,-3.706294583596982
BTC,bitcoin,usd,41446,3.248036397011369
ETH,ethereum,gbp,1853.43,1.422507551227988

1 symbol name base current 24hr change
2 BTC bitcoin usd 36800 41446 1.9889872710237515 3.248036397011369
3 ETH ethereum gbp 1747.56 1853.43 -3.706294583596982 1.422507551227988

View File

@ -1 +1 @@
["USD", {"AUD": [1.2922, 1.29], "CAD": [1.2107, 1.2078], "CHF": [0.89609, 0.89487], "EUR": [0.82142, 0.82001], "GBP": [0.70883, 0.70564], "JPY": [109.54, 109.37], "NZD": [1.3908, 1.3879]}]
["USD", {"AUD": [1.3001, 1.2959], "CAD": [1.2189, 1.2167], "CHF": [0.90015, 0.89903], "EUR": [0.8259, 0.82563], "GBP": [0.71151, 0.7092], "JPY": [110.08, 109.77], "NZD": [1.403, 1.4002]}]

View File

@ -1 +1 @@
{"main_weather": "Clouds", "description": "overcast clouds", "temp": 28.57, "min_temp": 27.92, "max_temp": 29.1, "feels_like": 34.55, "humidity": 85, "clouds": 100, "wind_speed": 2.68, "wind_direction": 90, "visibility": 10000, "uv": 0, "rain_chance": 0}
{"main_weather": "Clouds", "description": "overcast clouds", "temp": 29.6, "min_temp": 28.91, "max_temp": 30.21, "feels_like": 35.96, "humidity": 78, "clouds": 100, "wind_speed": 0.45, "wind_direction": 332, "visibility": 10000, "uv": 0, "rain_chance": 0.49}

View File

@ -1 +1 @@
[{"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.81, "max_temp": 29.53}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.37, "max_temp": 28.25}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.02, "max_temp": 28.42}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.54, "max_temp": 29.06}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.74, "max_temp": 29.65}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.14, "max_temp": 29.86}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.1, "max_temp": 29.89}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.42, "max_temp": 29.49}]
[{"main_weather": "Rain", "description": "light rain", "min_temp": 28.77, "max_temp": 30.09}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.25, "max_temp": 30.18}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.38, "max_temp": 30.34}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.71, "max_temp": 30.54}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.64, "max_temp": 30.36}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.8, "max_temp": 30.44}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.04, "max_temp": 29.26}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 26.78, "max_temp": 27.71}]

View File

@ -1 +1 @@
14/06/2021 14:19:22
15/06/2021 14:34:09

1 14/06/2021 14:19:22 15/06/2021 14:34:09

View File

@ -1,21 +1,21 @@
headline,source,date,time
Manchester United have £67m Jadon Sancho bid rejected by Dortmund - The Guardian,The Guardian,2021-06-10,18:35:00Z
1 in 5 children struggle with mental health; here's how you can help - IOL,IOL,2021-06-10,18:21:08Z
States uptake of coronavirus vaccines to be among highest worldwide^ says Holohan - The Irish Times,The Irish Times,2021-06-10,18:19:34Z
Manitoba ties vaccination goals to summer holidays but reopening plan short on details - CBC.ca,CBC News,2021-06-10,18:18:14Z
Biden says US to buy and donate half-billion doses of Pfizer's Covid vaccine: 'We know the tragedy. We also know the path to recovery' - CNN ,CNN,2021-06-10,18:16:00Z
Boris Johnson hails Biden administration as breath of fresh air after first meeting - Evening Standard,Evening Standard,2021-06-10,18:14:23Z
Study on plant roots challenges nature of ecological trade-offs - EurekAlert,EurekAlert,2021-06-10,18:04:28Z
Ethics committee calls for sweeping reforms in wake of WE Charity scandal - CBC.ca,CBC News,2021-06-10,18:02:27Z
Microsoft teases new Windows 11 startup sound with 11-minute video - The Verge,The Verge,2021-06-10,18:00:39Z
Wife of El Chapo Guzmán pleads guilty to aiding husbands drug trafficking empire - The Washington Post,The Washington Post,2021-06-10,17:59:00Z
No house price fall in sight^ ASB says in quarterly economic forecast - Stuff.co.nz,Stuff.co.nz,2021-06-10,17:58:00Z
Croatia moves to sanction 'revenge porn' - GMA News,GMA News,2021-06-10,17:54:07Z
England boosted by Rory Burns and Dan Lawrence fifties after New Zealand's six-wicket burst following lunch - Sky Sports,Sky Sports,2021-06-10,17:53:22Z
Then there were 3: NASA to collaborate on ESA's new Venus mission - Phys.org,Phys.Org,2021-06-10,17:50:17Z
Fingered for failings hed forgotten^ Matt Hancock wriggles free - The Guardian,The Guardian,2021-06-10,17:47:00Z
COVID-19 live updates: Montrealers share frustrations and tips on speeding up second vaccine doses - Montreal Gazette,Montreal Gazette,2021-06-10,17:46:56Z
California appeals judge's ruling that overturned state's ban on assault-style weapons - CNN ,CNN,2021-06-10,17:45:00Z
Morrisons hit by huge pay revolt The Telegraph - The Telegraph,Telegraph.co.uk,2021-06-10,17:42:00Z
Cricket: Black Caps fight back from slow start on opening day of second test against England - New Zealand Herald,New Zealand Herald,2021-06-10,17:30:35Z
Shikhar Dhawan To Lead India In Sri Lanka ODI^ T20I Series As BCCI Names Squad - NDTVSports.com,NDTV News,2021-06-10,17:26:15Z
Hungary vs Portugal LIVE: Euro 2020 latest score^ goals and updates from fixture today - The Independent,Independent,2021-06-15,16:37:47Z
Smash Bros Ultimate DLC reveal: Tekken's Kazuya revealed as next Fighters Pass 2 brawler - Express,Express,2021-06-15,16:32:33Z
Duterte retains GCQ with restrictions in NCR Plus - The Manila Times,The Manila Times,2021-06-15,16:30:00Z
Noul sistem de operare mobil pentru care 4 milioane de dezvoltatori dezvolta aplicatii - Dojotech.ro,Dojotech.ro,2021-06-15,16:23:19Z
SC orders Disini: Pay government ₧1 billion in damages for $2.2-billion nuke plant | Joel R. San Juan - Business Mirror,Businessmirror.com.ph,2021-06-15,16:14:00Z
MP Yasmin Ratansi put herself in conflict of interest by employing foster sister: ethics commissioner - CBC.ca,CBC News,2021-06-15,16:13:03Z
Chicago mass shooting: 8 shot^ 4 fatally^ in Englewood home - Chicago Sun-Times,Suntimes.com,2021-06-15,16:10:07Z
China^ Its Military Might Expanding^ Accuses NATO of Hypocrisy - The New York Times,New York Times,2021-06-15,16:09:49Z
US retail sales fell in May; UK jobless rate drops and payrolls rise business live - The Guardian,The Guardian,2021-06-15,16:07:54Z
Beats Studio Buds vs Apple AirPods Pro: the noise-cancelling earbuds compared - TechRadar,TechRadar,2021-06-15,16:06:16Z
India vs Afghanistan^ Highlights^ FIFA World Cup 2022 Qualifiers: India held to 1-1 draw - Firstpost,Firstpost,2021-06-15,16:02:53Z
Cicadas that come out every 17 years may emerge more often in the future - Science Magazine,Science Magazine,2021-06-15,16:00:00Z
Converge investing P1 billion for new data center - Philstar.com,Philippine Star,2021-06-15,16:00:00Z
Garland announces national strategy to combat domestic terrorism^ invoking US Capitol riot - CNN ,CNN,2021-06-15,15:55:00Z
Average Canadian house price up 38% compared to last year^ but down from March - CBC.ca,CBC News,2021-06-15,15:48:45Z
'Pure insanity': Emails detail Trump's pressure on Justice Department to overturn election - NBC News,NBC News,2021-06-15,15:48:26Z
UW astronomer redefines the scientific hero as part of The Great Courses - UW News,UW News,2021-06-15,15:46:44Z
Gone Girl actor Lisa Banes dies 10 days after hit-and-run - Independent.ie,Independent.ie,2021-06-15,15:44:00Z
Electrons can form a strange 2-D 'Flatland' in a superconductor - Games Bollyinside - BollyInside,Bollyinside.com,2021-06-15,15:43:49Z
BREAKING | There are no babies^ admits father of Tembisa 10 - News24,News24,2021-06-15,15:41:38Z

1 headline source date time
2 Manchester United have £67m Jadon Sancho bid rejected by Dortmund - The Guardian Hungary vs Portugal LIVE: Euro 2020 latest score^ goals and updates from fixture today - The Independent The Guardian Independent 2021-06-10 2021-06-15 18:35:00Z 16:37:47Z
3 1 in 5 children struggle with mental health; here's how you can help - IOL Smash Bros Ultimate DLC reveal: Tekken's Kazuya revealed as next Fighters Pass 2 brawler - Express IOL Express 2021-06-10 2021-06-15 18:21:08Z 16:32:33Z
4 State’s uptake of coronavirus vaccines to be among highest worldwide^ says Holohan - The Irish Times Duterte retains GCQ with restrictions in NCR Plus - The Manila Times The Irish Times The Manila Times 2021-06-10 2021-06-15 18:19:34Z 16:30:00Z
5 Manitoba ties vaccination goals to summer holidays but reopening plan short on details - CBC.ca Noul sistem de operare mobil pentru care 4 milioane de dezvoltatori dezvolta aplicatii - Dojotech.ro CBC News Dojotech.ro 2021-06-10 2021-06-15 18:18:14Z 16:23:19Z
6 Biden says US to buy and donate half-billion doses of Pfizer's Covid vaccine: 'We know the tragedy. We also know the path to recovery' - CNN SC orders Disini: Pay government ₧1 billion in damages for $2.2-billion nuke plant | Joel R. San Juan - Business Mirror CNN Businessmirror.com.ph 2021-06-10 2021-06-15 18:16:00Z 16:14:00Z
7 Boris Johnson hails Biden administration as ‘breath of fresh air’ after first meeting - Evening Standard MP Yasmin Ratansi put herself in conflict of interest by employing foster sister: ethics commissioner - CBC.ca Evening Standard CBC News 2021-06-10 2021-06-15 18:14:23Z 16:13:03Z
8 Study on plant roots challenges nature of ecological trade-offs - EurekAlert Chicago mass shooting: 8 shot^ 4 fatally^ in Englewood home - Chicago Sun-Times EurekAlert Suntimes.com 2021-06-10 2021-06-15 18:04:28Z 16:10:07Z
9 Ethics committee calls for sweeping reforms in wake of WE Charity scandal - CBC.ca China^ Its Military Might Expanding^ Accuses NATO of Hypocrisy - The New York Times CBC News New York Times 2021-06-10 2021-06-15 18:02:27Z 16:09:49Z
10 Microsoft teases new Windows 11 startup sound with 11-minute video - The Verge US retail sales fell in May; UK jobless rate drops and payrolls rise – business live - The Guardian The Verge The Guardian 2021-06-10 2021-06-15 18:00:39Z 16:07:54Z
11 Wife of ‘El Chapo’ Guzmán pleads guilty to aiding husband’s drug trafficking empire - The Washington Post Beats Studio Buds vs Apple AirPods Pro: the noise-cancelling earbuds compared - TechRadar The Washington Post TechRadar 2021-06-10 2021-06-15 17:59:00Z 16:06:16Z
12 No house price fall in sight^ ASB says in quarterly economic forecast - Stuff.co.nz India vs Afghanistan^ Highlights^ FIFA World Cup 2022 Qualifiers: India held to 1-1 draw - Firstpost Stuff.co.nz Firstpost 2021-06-10 2021-06-15 17:58:00Z 16:02:53Z
13 Croatia moves to sanction 'revenge porn' - GMA News Cicadas that come out every 17 years may emerge more often in the future - Science Magazine GMA News Science Magazine 2021-06-10 2021-06-15 17:54:07Z 16:00:00Z
14 England boosted by Rory Burns and Dan Lawrence fifties after New Zealand's six-wicket burst following lunch - Sky Sports Converge investing P1 billion for new data center - Philstar.com Sky Sports Philippine Star 2021-06-10 2021-06-15 17:53:22Z 16:00:00Z
15 Then there were 3: NASA to collaborate on ESA's new Venus mission - Phys.org Garland announces national strategy to combat domestic terrorism^ invoking US Capitol riot - CNN Phys.Org CNN 2021-06-10 2021-06-15 17:50:17Z 15:55:00Z
16 Fingered for failings he’d forgotten^ Matt Hancock wriggles free - The Guardian Average Canadian house price up 38% compared to last year^ but down from March - CBC.ca The Guardian CBC News 2021-06-10 2021-06-15 17:47:00Z 15:48:45Z
17 COVID-19 live updates: Montrealers share frustrations – and tips – on speeding up second vaccine doses - Montreal Gazette 'Pure insanity': Emails detail Trump's pressure on Justice Department to overturn election - NBC News Montreal Gazette NBC News 2021-06-10 2021-06-15 17:46:56Z 15:48:26Z
18 California appeals judge's ruling that overturned state's ban on assault-style weapons - CNN UW astronomer redefines the scientific hero as part of The Great Courses - UW News CNN UW News 2021-06-10 2021-06-15 17:45:00Z 15:46:44Z
19 Morrisons hit by huge pay revolt The Telegraph - The Telegraph Gone Girl actor Lisa Banes dies 10 days after hit-and-run - Independent.ie Telegraph.co.uk Independent.ie 2021-06-10 2021-06-15 17:42:00Z 15:44:00Z
20 Cricket: Black Caps fight back from slow start on opening day of second test against England - New Zealand Herald Electrons can form a strange 2-D 'Flatland' in a superconductor - Games Bollyinside - BollyInside New Zealand Herald Bollyinside.com 2021-06-10 2021-06-15 17:30:35Z 15:43:49Z
21 Shikhar Dhawan To Lead India In Sri Lanka ODI^ T20I Series As BCCI Names Squad - NDTVSports.com BREAKING | There are no babies^ admits father of ‘Tembisa 10’ - News24 NDTV News News24 2021-06-10 2021-06-15 17:26:15Z 15:41:38Z

View File

@ -1,4 +1,4 @@
name,current,opening
MSFT,258.44,257.9
NFLX,500.93,489.68
GOOG,2508.46,2513.39
MSFT,258.05,259.775
NFLX,492.27,501.23
GOOG,2519.23,2530.44

1 name current opening
2 MSFT 258.44 258.05 257.9 259.775
3 NFLX 500.93 492.27 489.68 501.23
4 GOOG 2508.46 2519.23 2513.39 2530.44

BIN
final.ppm

Binary file not shown.

View File

@ -320,6 +320,16 @@ def matrix():
LastCommand = 'Run display'
elif "Run League" in request.form:
ticker.sendline('K')
ticker.sendline('L')
elif "Run Teams" in request.form:
print('teams')
ticker.sendline('K')
ticker.sendline('t')
elif "Stop Display" in request.form:
print('run display')

View File

@ -85,7 +85,6 @@ class StockTicker():
#https://groups.google.com/forum/#!topic/cython-users/Dc1ft5W6KM4
img_width, img_height = image.size
print('args', img_width, img_height, offset_x, offset_y, image)
self.matrix.SetPixelsPillow(offset_x, offset_y, img_width, img_height, image)
else:
# First implementation of a SetImage(). OPTIMIZE_ME: A more native
@ -237,8 +236,6 @@ class StockTicker():
if matrix_height:
height = 32
print(text)
print('dims:', width, height)
img = Image.new('RGB', (width + buff + 3, height+3))
d = ImageDraw.Draw(img)
@ -300,7 +297,7 @@ class StockTicker():
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'news_logos')
logo = Image.open(os.path.join(logos_path, 'techcrunch' + '.png'))
print(logo.size)
img = Image.new('RGB', (headline_img.size[0], 32))
img.paste(headline_img, (2, -3))
img.paste(source_img, (2,16))
@ -333,7 +330,6 @@ class StockTicker():
# To iterate through the entire gif
i = 0
while True:
print(gif.tell())
try:
gif.seek(i)
except EOFError:
@ -459,7 +455,6 @@ class StockTicker():
new_im = Image.new('RGB', (total_width, max_height))
x_offset = 0
for im in image_list:
print(x_offset)
new_im.paste(im, (x_offset,0))
x_offset += im.size[0]
@ -510,7 +505,7 @@ class StockTicker():
for i, coin in enumerate(self.coins):
info = self.coin_info[coin]
print(info)
change = float(info[3]) #TEXT
ticker = info[0] #TEXT
current = float(info[2]) #TEXT
@ -546,9 +541,9 @@ class StockTicker():
for i, currency in enumerate(['AUD', 'CAD', 'CHF', 'EUR', 'GBP', 'JPY', 'NZD']):
current, yesterday = currency_info[currency]
print(current, yesterday)
change = 1/current - 1/yesterday
print(change)
current = 1/current
current = '%.3f' % current
@ -589,13 +584,126 @@ class StockTicker():
elif updated_img == 2:
finalDisplayImage.save('final1.ppm')
def getLeagueImage(self):
img = Image.new('RGB', (10000, 32))
league_info = json.load(open('/home/pi/Desktop/stock_ticker/csv/sports/premier_league/past_games.json', 'r'))
print(league_info[0].keys())
small_font = ImageFont.load("./fonts/5x7.pil")
large_font = ImageFont.load("./fonts/10x20.pil")
buff_size = 20
x_offset = 0
print(len(league_info))
for match in league_info[-15:]:
home_team = match['home_team']
away_team = match['away_team']
home_score = match['home_score']
away_score = match['away_score']
date = match['date']
rond = match['round']
try:
home_logo = Image.open('/home/pi/Desktop/stock_ticker/logos/sports/premier_league/' + home_team +'.png')
except:
home_logo = self.textImage(home_team.replace(' ', '\n'), small_font, r = 255, g = 255, b = 255)
print(home_team)
try:
away_logo = Image.open('/home/pi/Desktop/stock_ticker/logos/sports/premier_league/' + away_team +'.png')
except:
away_logo = self.textImage(away_team.replace(' ', '\n'), small_font, r = 255, g = 255, b = 255)
home_timage = self.textImage(home_team, small_font, r = 255, g = 255, b = 255)
away_timage = self.textImage(away_team, small_font, r = 255, g = 255, b = 255)
date_timage = self.textImage(date, small_font, r = 255, g = 255, b = 0)
round_timage = self.textImage('round:' + rond, small_font, r = 255, g = 255, b = 255)
score_image = self.textImage(home_score + '-' + away_score, large_font, r = 255, g = 255, b = 255)
img.paste(home_logo, (x_offset,0))
x_offset += home_logo.size[0] + 2
#img.paste(home_timage, (x_offset, 0))
#img.paste(away_timage, (x_offset, 5))
img.paste(date_timage, (x_offset, 0))
img.paste(round_timage, (x_offset+ 7, 8))
img.paste(score_image, (x_offset+10, 15))
#x_offset += max(home_timage.size[0], away_timage.size[0], date_timage.size[0], round_timage.size[0], score_image.size[0])
x_offset += max( date_timage.size[0], round_timage.size[0], score_image.size[0])
img.paste(away_logo, (x_offset,0))
x_offset += away_logo.size[0] + 2
x_offset += buff_size
img = img.crop((0,0,x_offset ,32))
return img
def getTeamsImage(self):
img = Image.new('RGB', (10000, 32))
team_info = json.load(open('/home/pi/Desktop/stock_ticker/csv/sports/premier_league/team_stats.json', 'r'))
small_font = ImageFont.load("./fonts/5x7.pil")
med_font = ImageFont.load("./fonts/7x14.pil")
large_font = ImageFont.load("./fonts/10x20.pil")
buff_size = 20
x_offset = 0
for team in team_info:
try:
logo = Image.open('/home/pi/Desktop/stock_ticker/logos/sports/premier_league/' + team['name'] +'.png')
img.paste(logo, (x_offset, 0))
x_offset += logo.size[0] + 2
except:
print('no logo for:', team['name'])
name_timage = self.textImage(team['name'], med_font, r = 255, g = 255, b = 0)
wins_timage = self.textImage('Wins:' + team['wins'], small_font, r = 0, g = 255, b = 0)
loss_timage = self.textImage('Losses:' + team['loss'], small_font, r = 255, g = 0, b = 0)
draw_timage = self.textImage('Draws:' + team['draw'], small_font, r = 0, g = 0, b = 255)
points_timage = self.textImage('Points:' + team['points'], small_font, r = 255, g = 255, b = 255)
standing_timage = self.textImage('Standing:' + team['standing'], small_font, r = 255, g = 255, b = 255)
img.paste(name_timage, (x_offset, -2))
img.paste(wins_timage, (x_offset, 11))
img.paste(loss_timage, (x_offset, 18))
img.paste(draw_timage, (x_offset, 25))
x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0])
img.paste(points_timage, (x_offset, 14))
img.paste(standing_timage, (x_offset, 22))
x_offset += max(points_timage.size[0], standing_timage.size[0]) + buff_size
img = img.crop((0,0,x_offset ,32))
return img
def getTodayWeatherImage(self):
img = Image.new('RGB', (200, 32))
f = open( "csv/weather_location.txt", 'r' )
location = f.read()
f.close()
print(location)
current_weather = json.load(open('csv/current_weather.json', 'r'))
@ -624,7 +732,7 @@ class StockTicker():
img.paste(temp_img, (36,9))
deg_img = self.textImage('o', small_font)
print(temp_img.size)
img.paste(deg_img, (56, 8))
main = current_weather['main_weather']
@ -693,8 +801,6 @@ class StockTicker():
vtext_img = self.textImage(str(current_weather['visibility']/1000) + 'km', small_font)
img.paste(vtext_img, (168, 22))
return img
def getDailyWeatherImageAlt(self):
@ -753,8 +859,6 @@ class StockTicker():
rain_img = Image.open(weather_dir + '/rain-chance.png')
rtext_img = self.textImage(str(int(current_weather['rain_chance']*100)) + '%', extra_small_font)
@ -773,7 +877,7 @@ class StockTicker():
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))
@ -948,10 +1052,6 @@ class StockTicker():
vtext_img = self.textImage(str(current_weather['visibility']/1000) + 'km', small_font)
print(temp_img.size)
img.paste(location_img, (0,0))
img.paste(weather_img, (0,12))
img.paste(temp_img, (30,9))
@ -1024,12 +1124,6 @@ class StockTicker():
return img1
#Send the final stitched image to the display for set amount of time
def displayStocks(self):
#os.system("sudo ./demo -D1 final.ppm -t " + str(displayTime) +" -m "+ str(speedDisplay) +" --led-gpio-mapping=adafruit-hat --led-rows=32 --led-cols=256")
#os.system("sudo ./demo -D1 final.ppm -t " + str(self.displayTime) +" -m "+ str(self.speedDisplay) +" --led-gpio-mapping=adafruit-hat --led-rows=64 --led-cols=64 --led-slowdown-gpio=4 ")
self.scrollImageTransition(['final.ppm', 'final.ppm'], offset_x = 0, offset_y = 0)
#Retrieve symbols and stock info from the csv file
@ -1067,42 +1161,6 @@ class StockTicker():
f.close()
#Main run definition called by server
def runStockTicker(self, runtime, delay, speedtime):
self.getSymbols()
self.GetfullStockImage()
self.keySwapper += 1
self.running = True
while (True):
if (self.running == True):
#th = threading.Thread(target=self.displayMatrix)
#th.start()
self.displayMatrix()
time.sleep((int(runtime) - int(delay)))
self.getfullStockImage()
#th.join()
else:
break;
#Change running to false stopping refresh at next checkpoint
def stopStockTicker(self):
self.keySwapper = 0
self.running = False
print('MATRIX DISPLAY STOP CALLED')
def displayDailyWeatherAlt(self):
img0, img1 = self.getDailyWeatherImageAlt()
@ -1144,11 +1202,10 @@ class StockTicker():
time.sleep(self.delay*1.1)
def displayStocks(self):
self.scrollImageTransition(['final.ppm', 'final.ppm'], offset_x = 0, offset_y = 0)
def process_msg(self, msg):
if msg == 'S': # stocks
@ -1209,16 +1266,31 @@ class StockTicker():
#self.setImage( image)
self.scrollImageTransition(['weather.ppm', 'weather.ppm'], stocks = False)
elif msg == 'L': # league
img = self.getLeagueImage()
img.save('league.ppm')
stock_ticker.scrollImageTransition(['league.ppm', 'league.ppm'], stocks = False)
elif msg == 't': #teams
img = self.getTeamsImage()
img.save('teams.ppm')
stock_ticker.scrollImageTransition(['teams.ppm', 'teams.ppm'], stocks = False)
elif msg == 'K': # kill
self.resetMatrix()
if __name__ == '__main__':
#print(sys.stdin.readlines())
with open('log.txt', "w") as log:
try:
stock_ticker = StockTicker()
#img = stock_ticker.getLeagueImage()
#img.save('league.ppm')
#stock_ticker.scrollImageTransition(['league.ppm', 'league.ppm'], stocks = False)

View File

@ -14,6 +14,8 @@
<input type="submit" name="Run News" value="Run News" style="height:50px" >
<input type="submit" name="Run Weather" value="Run Weather" style="height:50px" >
<input type="submit" name="Run Daily Weather" value="Run Daily Weather" style="height:50px" >
<input type="submit" name="Run League" value="Run League" style="height:50px" >
<input type="submit" name="Run Teams" value="Run Teams" style="height:50px" >
<input type="submit" name="Stop Display" value="Stop Display"style="height:50px">
<input type="submit" name="Shutdown the pi" value="Shutdown the pi"style="height:50px">
</form>

Binary file not shown.