bug fixes

This commit is contained in:
Neythen 2021-07-06 20:15:05 +01:00
parent cc48129f69
commit dbc750ed67
24 changed files with 98 additions and 107 deletions

View File

@ -350,8 +350,10 @@ def updateWeather():
daily_weathers.append(daily_weather)
json.dump( current_weather, open( "csv/current_weather.json", 'w+' ))
json.dump( daily_weather, open( "csv/daily_weather.json", 'w+' ))
json.dump( current_weathers, open( "csv/current_weather.json", 'w+' ))
json.dump( daily_weathers, open( "csv/daily_weather.json", 'w+' ))
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
@ -464,9 +466,6 @@ def updateLeagueEvents(api_key, league_id, time):
r = requests.get(url)
all_data = r.json()
print()
print(all_data['events'])
#print([all_data['events'][i]['strTimestamp'] for i in range(len(all_data['events']))])
events = []
@ -610,9 +609,13 @@ if __name__ == '__main__':
#json.dump(update_times, f)
#f.close()
f = open('csv/last_updates.json', 'r')
last_updates = json.load(f)
f.close()
try:
f = open('csv/last_updates.json', 'r')
last_updates = json.load(f)
f.close()
except:
last_updates = {"stocks": "27/06/2021 07:05:39", "crypto": "27/06/2021 07:05:39", "news": "27/06/2021 07:05:39", "weather": "27/06/2021 07:05:39", "forex": "27/06/2021 07:05:39", "sports": "27/06/2021 07:05:39"}
t = time.time()
@ -689,9 +692,9 @@ if __name__ == '__main__':
last_updates['forex'] = forex_time
updateForex()
f = open('csv/last_updates.json', 'w+')
json.dump(last_updates, f)
f.close()
json.dump(last_updates, open('csv/last_updates.json', 'w+'))
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()

View File

@ -1,4 +1,4 @@
symbol,name,base,current,24hr change
BTC,bitcoin,usd,34115,-3.9390505068289396
ETH,ethereum,gbp,1613.18,-5.164585106324053
DOGE,dogecoin,usd,0.234738,-5.759603392786582
BTC,bitcoin,usd,33900,-0.8918953711475721
ETH,ethereum,gbp,1679.65,3.4282607943042347
DOGE,dogecoin,usd,0.230969,-1.3970219999749205

1 symbol name base current 24hr change
2 BTC bitcoin usd 34115 33900 -3.9390505068289396 -0.8918953711475721
3 ETH ethereum gbp 1613.18 1679.65 -5.164585106324053 3.4282607943042347
4 DOGE dogecoin usd 0.234738 0.230969 -5.759603392786582 -1.3970219999749205

View File

@ -1 +1 @@
["USD", {"AUD": [1.3299, 1.3305], "CAD": [1.2381, 1.2411], "CHF": [0.92004, 0.9212], "EUR": [0.84076, 0.84097], "GBP": [0.71935, 0.72046], "JPY": [110.56, 110.09], "NZD": [1.4302, 1.4344]}]
["USD", {"AUD": [1.3206, 1.3282], "CAD": [1.2367, 1.2362], "CHF": [0.9233, 0.92154], "EUR": [0.84474, 0.84274], "GBP": [0.72183, 0.72194], "JPY": [110.65, 110.89], "NZD": [1.411, 1.4243]}]

View File

@ -1 +1 @@
{"main_weather": "Clouds", "description": "overcast clouds", "temp": 16.03, "min_temp": 13.39, "max_temp": 20.92, "feels_like": 15.75, "humidity": 79, "clouds": 100, "wind_speed": 4.12, "wind_direction": 150, "visibility": 10000, "uv": 0.1, "rain_chance": 0.19}
[{"main_weather": "Clouds", "description": "broken clouds", "temp": 27.94, "min_temp": 27.68, "max_temp": 28.73, "feels_like": 33.73, "humidity": 91, "clouds": 72, "wind_speed": 4.47, "wind_direction": 110, "visibility": 10000, "uv": 0, "rain_chance": 0.64}, {"main_weather": "Clouds", "description": "overcast clouds", "temp": 15.73, "min_temp": 12.66, "max_temp": 18.47, "feels_like": 15.47, "humidity": 81, "clouds": 95, "wind_speed": 6.17, "wind_direction": 220, "visibility": 10000, "uv": 0.19, "rain_chance": 0.26}]

View File

@ -1 +1 @@
[{"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.39, "max_temp": 20.92}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.54, "max_temp": 17.84}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.1, "max_temp": 19.58}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.6, "max_temp": 22.73}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.49, "max_temp": 20.58}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.43, "max_temp": 20.19}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.57, "max_temp": 23.96}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 15.38, "max_temp": 22.74}]
[[{"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.68, "max_temp": 28.73}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.24, "max_temp": 29.6}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.62, "max_temp": 29.69}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 27.46, "max_temp": 29.53}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.85, "max_temp": 29.76}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.87, "max_temp": 29.59}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 27.6, "max_temp": 29.63}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 27.71, "max_temp": 29.57}], [{"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.66, "max_temp": 18.47}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.87, "max_temp": 19.55}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.64, "max_temp": 21.63}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 14.24, "max_temp": 23.25}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.32, "max_temp": 20.42}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.78, "max_temp": 18.6}, {"main_weather": "Rain", "description": "light rain", "min_temp": 12.95, "max_temp": 17.28}, {"main_weather": "Rain", "description": "light rain", "min_temp": 11.05, "max_temp": 21.53}]]

View File

@ -0,0 +1 @@
{"stocks": "06/07/2021 15:14:18", "crypto": "06/07/2021 15:14:18", "news": "06/07/2021 15:14:20", "weather": "06/07/2021 15:14:19", "forex": "06/07/2021 21:14:23", "sports": "06/07/2021 15:14:21"}

View File

@ -1,21 +1,21 @@
headline,source,date,time
'Gravitational slingshot' in star clusters may explain stellar streams - Siliconrepublic.com,Siliconrepublic.com,2021-07-05,16:27:31Z
Number of children living in motels reaches record high despite Govt's pledge to combat child poverty - New Zealand Herald,New Zealand Herald,2021-07-05,16:25:58Z
Baba Ijesha: Yomi Fabiyi under fire over new movie Oko Iyabo - Punch Newspapers,The Punch,2021-07-05,16:24:26Z
Rescue mission in 'hot pursuit' after gunmen kidnap scores of students in northwest Nigeria - CNN ,CNN,2021-07-05,16:17:00Z
COVID-19: Almost all coronavirus rules - including face masks and home-working - to be ditched on 19 July^ PM says - Sky News,Sky.com,2021-07-05,16:07:30Z
Gov't fully awards T-bills even as yields rise on inflation bets - BusinessWorld Online,BusinessWorld Online,2021-07-05,16:03:17Z
Newark Airport evacuation: 'Security concern' sparks panic in New Jersey - 'Ran so fast' - Daily Express,Express,2021-07-05,16:02:20Z
Province Confident Vaccinations Will Blunt Delta Variant - Discoverestevan.com - DiscoverEstevan.com,DiscoverEstevan.com,2021-07-05,16:00:29Z
Nnamdi Kanu: We have evidence of Nigeria^ Kenyas dirty deal to arrest our leader IPOB - Daily Post Nigeria,Daily Post Nigeria,2021-07-05,16:00:10Z
Stocks hold above 7^000 ahead of inflation data - Philstar.com,Philippine Star,2021-07-05,16:00:00Z
Explorers Club Kicks Off 2021 Global Exploration Summit - PRNewswire,PRNewswire,2021-07-05,16:00:00Z
Vaping could increase your risk of Covid-19 infection^ new study finds By IANS 0s ago - IOL,IOL,2021-07-05,15:59:56Z
Astronomers discover an oversized black hole population in the star cluster Palomar 5 - Science Daily,Science Daily,2021-07-05,15:58:17Z
Blake Shelton^ Gwen Stefani marry in intimate ceremony at church on singers sprawling estate: reports - Fox News,Fox News,2021-07-05,15:55:03Z
Batanes^ Babuyan Islands still under Signal No. 1 as TD Emong moves away - INQUIRER.net,Inquirer.net,2021-07-05,15:54:00Z
Microbes that feast on crushed rocks thrive in Antarctica's ice-covered lakes - Livescience.com,Live Science,2021-07-05,15:52:50Z
New study attempts to characterize long-COVID in all its complexity - News-Medical.Net,News-Medical.Net,2021-07-05,15:47:00Z
Megszakad a szív^ négy koporsó egy ravatalon: Utolsó útjára kísérték a tarpai orvost^ feleségét és két gyermekét Megrázó fotók - Bors,Borsonline.hu,2021-07-05,15:45:00Z
Scientists stunned to find vast collection of more than 100 black holes inside our own galaxy - The Independent,Independent,2021-07-05,15:42:01Z
Samsung to bring the Thom Browne Edition of the Galaxy Z Flip3^ claims report - Times of India,The Times of India,2021-07-05,15:42:00Z
Long Covid campaigners urge Sajid Javid to reconsider timing of restriction lifting - The Independent,Independent,2021-07-06,18:36:30Z
Italy vs. Spain: UEFA Euro 2020 live stream^ TV channel^ how to watch semifinal online^ news^ odds^ time - CBS Sports,CBS Sports,2021-07-06,18:32:00Z
Heart health: Sureshot ways to prevent a heart attack right now^ as per experts - Times of India,The Times of India,2021-07-06,18:30:00Z
Tuck into this breathtaking SA dino breakthrough - TimesLIVE,TimesLIVE,2021-07-06,18:17:00Z
Steven Gallant: Inmate who tackled Fishmongers' Hall attacker to be released from prison - Sky News,Sky.com,2021-07-06,18:09:05Z
Uncertainty surrounds Zambias Kaunda funeral as family contests burial site - Punch Newspapers,The Punch,2021-07-06,17:59:49Z
Giannis Antetokounmpo knee injury: Bucks star upgraded to questionable for NBA Finals Game 1 vs. Suns - CBS Sports,CBS Sports,2021-07-06,17:54:00Z
Girls' Generation's Taeyeon relaxes in 'Weekend' music video - UPI News,UPI.com,2021-07-06,17:52:35Z
Manitoba tops vaccine milestone tied to next phase of reopenings - CBC.ca,CBC News,2021-07-06,17:52:05Z
Astronomers Spot a Batch of Rogue Planets Near the Galactic Core - Gizmodo,Gizmodo.com,2021-07-06,17:50:00Z
DOD cancels $10 billion JEDI contract at center of Microsoft and Amazon feud - Engadget,Engadget,2021-07-06,17:48:45Z
Italy vs Spain^ Euro 2020 LIVE: Line-ups^ team news and latest updates - MARCA.com,Marca,2021-07-06,17:45:17Z
Eswatini turmoil: Sanef pleads with Ramaphosa to mobilise SADC leaders following attack on journalists - News24,News24,2021-07-06,17:44:49Z
Tragic mum dies after becoming trapped in charity bin while looking for clothes - The Mirror,Mirror Online,2021-07-06,17:41:37Z
Under fire over activist Stan Swamys death^ govt says detention was in accordance with law - The Indian Express,The Indian Express,2021-07-06,17:41:25Z
Taliban Try to Polish Their Image as They Push for Victory - The New York Times,New York Times,2021-07-06,17:40:38Z
Italy XI vs Spain: Starting lineup^ latest team news^ squad^ injury update for Euros semi-final today - Evening Standard,Evening Standard,2021-07-06,17:40:07Z
Civil engineer claims he was defamed by newspaper in court report about uninsured driver with the same name - Independent.ie,Independent.ie,2021-07-06,17:38:00Z
Covid 19 coronavirus: Fiji records six deaths^ 636 new cases in 24 hours - New Zealand Herald,New Zealand Herald,2021-07-06,17:32:29Z
Former Ulster Bank CEO Cormac McCarthy dies suddenly aged 58 - The Irish Times,The Irish Times,2021-07-06,17:27:04Z

1 headline source date time
2 'Gravitational slingshot' in star clusters may explain stellar streams - Siliconrepublic.com Long Covid campaigners urge Sajid Javid to ‘reconsider’ timing of restriction lifting - The Independent Siliconrepublic.com Independent 2021-07-05 2021-07-06 16:27:31Z 18:36:30Z
3 Number of children living in motels reaches record high despite Govt's pledge to combat child poverty - New Zealand Herald Italy vs. Spain: UEFA Euro 2020 live stream^ TV channel^ how to watch semifinal online^ news^ odds^ time - CBS Sports New Zealand Herald CBS Sports 2021-07-05 2021-07-06 16:25:58Z 18:32:00Z
4 Baba Ijesha: Yomi Fabiyi under fire over new movie ‘Oko Iyabo’ - Punch Newspapers Heart health: Sureshot ways to prevent a heart attack right now^ as per experts - Times of India The Punch The Times of India 2021-07-05 2021-07-06 16:24:26Z 18:30:00Z
5 Rescue mission in 'hot pursuit' after gunmen kidnap scores of students in northwest Nigeria - CNN Tuck into this breathtaking SA dino breakthrough - TimesLIVE CNN TimesLIVE 2021-07-05 2021-07-06 16:17:00Z 18:17:00Z
6 COVID-19: Almost all coronavirus rules - including face masks and home-working - to be ditched on 19 July^ PM says - Sky News Steven Gallant: Inmate who tackled Fishmongers' Hall attacker to be released from prison - Sky News Sky.com 2021-07-05 2021-07-06 16:07:30Z 18:09:05Z
7 Gov't fully awards T-bills even as yields rise on inflation bets - BusinessWorld Online Uncertainty surrounds Zambia’s Kaunda funeral as family contests burial site - Punch Newspapers BusinessWorld Online The Punch 2021-07-05 2021-07-06 16:03:17Z 17:59:49Z
8 Newark Airport evacuation: 'Security concern' sparks panic in New Jersey - 'Ran so fast' - Daily Express Giannis Antetokounmpo knee injury: Bucks star upgraded to questionable for NBA Finals Game 1 vs. Suns - CBS Sports Express CBS Sports 2021-07-05 2021-07-06 16:02:20Z 17:54:00Z
9 Province Confident Vaccinations Will Blunt Delta Variant - Discoverestevan.com - DiscoverEstevan.com Girls' Generation's Taeyeon relaxes in 'Weekend' music video - UPI News DiscoverEstevan.com UPI.com 2021-07-05 2021-07-06 16:00:29Z 17:52:35Z
10 Nnamdi Kanu: We have evidence of Nigeria^ Kenya’s dirty deal to arrest our leader – IPOB - Daily Post Nigeria Manitoba tops vaccine milestone tied to next phase of reopenings - CBC.ca Daily Post Nigeria CBC News 2021-07-05 2021-07-06 16:00:10Z 17:52:05Z
11 Stocks hold above 7^000 ahead of inflation data - Philstar.com Astronomers Spot a Batch of Rogue Planets Near the Galactic Core - Gizmodo Philippine Star Gizmodo.com 2021-07-05 2021-07-06 16:00:00Z 17:50:00Z
12 Explorers Club Kicks Off 2021 Global Exploration Summit - PRNewswire DOD cancels $10 billion JEDI contract at center of Microsoft and Amazon feud - Engadget PRNewswire Engadget 2021-07-05 2021-07-06 16:00:00Z 17:48:45Z
13 Vaping could increase your risk of Covid-19 infection^ new study finds By IANS 0s ago - IOL Italy vs Spain^ Euro 2020 LIVE: Line-ups^ team news and latest updates - MARCA.com IOL Marca 2021-07-05 2021-07-06 15:59:56Z 17:45:17Z
14 Astronomers discover an oversized black hole population in the star cluster Palomar 5 - Science Daily Eswatini turmoil: Sanef pleads with Ramaphosa to mobilise SADC leaders following attack on journalists - News24 Science Daily News24 2021-07-05 2021-07-06 15:58:17Z 17:44:49Z
15 Blake Shelton^ Gwen Stefani marry in intimate ceremony at church on singer’s sprawling estate: reports - Fox News Tragic mum dies after becoming trapped in charity bin while looking for clothes - The Mirror Fox News Mirror Online 2021-07-05 2021-07-06 15:55:03Z 17:41:37Z
16 Batanes^ Babuyan Islands still under Signal No. 1 as TD Emong moves away - INQUIRER.net Under fire over activist Stan Swamy’s death^ govt says ‘detention was in accordance with law’ - The Indian Express Inquirer.net The Indian Express 2021-07-05 2021-07-06 15:54:00Z 17:41:25Z
17 Microbes that feast on crushed rocks thrive in Antarctica's ice-covered lakes - Livescience.com Taliban Try to Polish Their Image as They Push for Victory - The New York Times Live Science New York Times 2021-07-05 2021-07-06 15:52:50Z 17:40:38Z
18 New study attempts to characterize long-COVID in all its complexity - News-Medical.Net Italy XI vs Spain: Starting lineup^ latest team news^ squad^ injury update for Euros semi-final today - Evening Standard News-Medical.Net Evening Standard 2021-07-05 2021-07-06 15:47:00Z 17:40:07Z
19 Megszakad a szív^ négy koporsó egy ravatalon: Utolsó útjára kísérték a tarpai orvost^ feleségét és két gyermekét – Megrázó fotók - Bors Civil engineer claims he was defamed by newspaper in court report about uninsured driver with the same name - Independent.ie Borsonline.hu Independent.ie 2021-07-05 2021-07-06 15:45:00Z 17:38:00Z
20 Scientists stunned to find vast collection of more than 100 black holes inside our own galaxy - The Independent Covid 19 coronavirus: Fiji records six deaths^ 636 new cases in 24 hours - New Zealand Herald Independent New Zealand Herald 2021-07-05 2021-07-06 15:42:01Z 17:32:29Z
21 Samsung to bring the Thom Browne Edition of the Galaxy Z Flip3^ claims report - Times of India Former Ulster Bank CEO Cormac McCarthy dies suddenly aged 58 - The Irish Times The Times of India The Irish Times 2021-07-05 2021-07-06 15:42:00Z 17:27:04Z

View File

@ -1 +1 @@
[{"date": "2021-07-06", "time": "00:00:00", "round": "0", "home_team": "Montreal Canadiens", "home_score": null, "away_team": "Tampa Bay Lightning", "away_score": null}]
[{"date": "2021-07-06", "time": "00:00:00", "round": "0", "home_team": "Montreal Canadiens", "home_score": "3", "away_team": "Tampa Bay Lightning", "away_score": "2"}, {"date": "2021-07-08", "time": "00:00:00", "round": "0", "home_team": "Tampa Bay Lightning", "home_score": null, "away_team": "Montreal Canadiens", "away_score": null}]

View File

@ -1 +1 @@
[]
[{"date": "2021-07-06", "time": "00:00", "progess": "", "status": "AOT", "home_team": "Montreal Canadiens", "home_score": "3", "away_team": "Tampa Bay Lightning", "away_score": "2"}]

View File

@ -1,4 +1,4 @@
name,current,opening
MSFT,277.65,272.82
NFLX,533.98,535.5
GOOG,2574.38,2536.79
MSFT,276.845,278.03
NFLX,541.92,533
GOOG,2589.7622,2588.99

1 name current opening
2 MSFT 277.65 276.845 272.82 278.03
3 NFLX 533.98 541.92 535.5 533
4 GOOG 2574.38 2589.7622 2536.79 2588.99

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
display_images/weather.ppm Executable file → Normal file

Binary file not shown.

View File

@ -275,54 +275,33 @@ def AddLogo():
@app.route("/matrix", methods=['POST'])
def matrix():
global LastCommand
if "Run Stocks" in request.form:
pass
print('run display')
#stock_ticker.runStockTicker(command, DelayTime, speedTime)
#stock_ticker.displayMatrix()
#os.system("sudo -E python3 test.py")
#
#child.sendline('sent from server')
#process = Popen(["sudo", "-E", "python3", "stockTicker.py"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
ticker.sendline('K')
ticker.sendline('S')
elif "Run Crypto" in request.form:
ticker.sendline('K')
ticker.sendline('C')
print('back in flask')
elif "Run Forex" in request.form:
ticker.sendline('K')
ticker.sendline('f')
LastCommand = 'Run display'
elif "Run News" in request.form:
print('run display')
ticker.sendline('K')
ticker.sendline('N')
print('back in flask')
LastCommand = 'Run display'
elif "Run Weather" in request.form:
ticker.sendline('K')
ticker.sendline('W')
print('back in flask')
LastCommand = 'Run display'
elif "Run Daily Weather" in request.form:
ticker.sendline('K')
ticker.sendline('D')
print('back in flask')
LastCommand = 'Run display'
elif "Past NHL" in request.form:
ticker.sendline('K')
ticker.sendline('P')
@ -346,11 +325,8 @@ def matrix():
ticker.sendline('A')
elif "Stop Display" in request.form:
print('run display')
#ticker.kill()
try:
#stock_ticker.stopStockTicker()
LastCommand = 'Stop display at next checkpoint'
ticker.sendline('K')
except:
@ -358,7 +334,6 @@ def matrix():
elif "Shutdown the pi" in request.form:
try:
LastCommand = 'shutdown'
os.system("sudo shutdown now")
except:
print("couldn't shutdown")

View File

@ -122,6 +122,8 @@ class StockTicker():
kill = self.checkKilled()
if kill:
break
time.sleep(self.delay)
return kill
@ -489,19 +491,10 @@ class StockTicker():
self.matrix.SetPixel(x , y , 0,0,0)
try:
msg = getInput()
if msg == 'K':
gif.close()
self.resetMatrix()
return True
self.process_msg(msg)
except KeyboardInterrupt:
sys.stdout.flush()
pass
return False
kill = self.checkKilled()
if kill:
break
return kill
#Using change between min and day price give appropriate arrow
#and set the overall change colour
@ -1128,11 +1121,12 @@ class StockTicker():
title_img = self.openImage('feature_titles/weather.png')
imgs = [title_img]
for location in locations:
current_weathers = json.load(open('csv/current_weather.json', 'r'))
for i, location in enumerate(locations):
img = Image.new('RGB', (200, 32))
current_weather = json.load(open('csv/current_weather.json', 'r'))
current_weather = current_weathers[i]
small_font = ImageFont.load("./fonts/5x7.pil")
large_font = ImageFont.load("./fonts/10x20.pil")
@ -1381,10 +1375,15 @@ class StockTicker():
title_img = self.openImage('feature_titles/weather.png')
imgs = [title_img]
for location in locations:
current_weathers = json.load(open('csv/current_weather.json', 'r'))
daily_weathers = json.load(open('csv/daily_weather.json', 'r'))
for i, location in enumerate(locations):
img = Image.new('RGB', (1000, 32))
current_weather = json.load(open('csv/current_weather.json', 'r'))
current_weather = current_weathers[i]
daily_weather = daily_weathers[i]
small_font = ImageFont.load("./fonts/5x7.pil")
extra_small_font = ImageFont.load("./fonts/4x6.pil")
@ -1515,7 +1514,7 @@ class StockTicker():
#img.paste(wtext_img, (109,0))
daily_weather = json.load(open('csv/daily_weather.json', 'r'))
#img.paste(date_img, (70, 0))
@ -1667,13 +1666,29 @@ class StockTicker():
def process_msg(self, msg):
if msg == 'S': # stocks
#img = self.getStockImage()
img = self.getStockProfessional()
img = self.getStockImage()
#img = self.getStockProfessional()
img.save('display_images/stocks.ppm')
self.scrollImageTransition(['display_images/stocks.ppm', 'display_images/stocks.ppm'], stocks = False)
elif msg == 'C': # crypto
img = self.getCryptoImage()
#img = self.getStockProfessional()
img.save('display_images/crypto.ppm')
self.scrollImageTransition(['display_images/crypto.ppm', 'display_images/crypto.ppm'], stocks = False)
elif msg == 'f': # stocks
img = self.getForexImage()
#img = self.getStockProfessional()
img.save('display_images/forex.ppm')
self.scrollImageTransition(['display_images/forex.ppm', 'display_images/forex.ppm'], stocks = False)
elif msg == 'N': #news
img = self.getNewsImage()
@ -1726,7 +1741,7 @@ class StockTicker():
elif msg == 'W': # weather
img = self.getTodayWeatherImage()
img.save('display_images/weather.ppm')
self.scrollImageTransition(['display_images/weather.ppm', 'display_images/weather.ppm'], stocks = False)
self.scrollImageTransition(['display_images/weather.ppm', 'display_images/today_weather.ppm'], stocks = False)
elif msg == 'D': # daily weather
#self.displayDailyWeatherAlt()
@ -1734,7 +1749,7 @@ class StockTicker():
img = self.getDailyWeatherImage()
img.save('display_images/weather.ppm')
#self.setImage( image)
self.scrollImageTransition(['display_images/weather.ppm', 'display_images/weather.ppm'], stocks = False)
self.scrollImageTransition(['display_images/weather.ppm', 'display_images/daily_weather.ppm'], stocks = False)
elif msg == 'P': # past league
img = self.getLeagueImage('NBA', 'past')
@ -1763,10 +1778,11 @@ class StockTicker():
elif msg == 'A': #everything
self.functions = {'stocks': self.getStockImage, 'crypto': self.getCryptoImage, 'forex': self.getForexImage,
'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getDailyWeatherImage, 'league_table': self.getLeagueTableImage,
'daily_weather':self.getDailyWeatherImage, 'today_weather': self.getTodayWeatherImage, 'league_table': self.getLeagueTableImage,
'league_games': self.getLeagueImage, 'news':self.getNewsImage, 'text': self.getUserText, 'display_image': self.getUserImage, 'display_gif':self.getUserGIF} #put this somewhere else
userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo
#userSettings = [ 'daily_weather']
#userSettings = ['crypto', 'stocks'] # these wil be read from csv, just for demo
#userSettings = [ 'display_image', 'news'] # these wil be read from csv, just for demo
@ -1780,7 +1796,7 @@ if __name__ == '__main__':
with open('log.txt', "w") as log:
try:
stock_ticker = StockTicker()
'''
img = stock_ticker.getStockProfessional()
img.paste(stock_ticker.getCryptoProfessional(), (0, 16))
@ -1790,7 +1806,7 @@ if __name__ == '__main__':
if kill:
break
'''
#stock_ticker.process_msg(P')
#stock_ticker.process_msg('G')
#stock_ticker.process_msg('f')

View File

@ -11,6 +11,8 @@
<br><br>
<form action="/matrix" method="POST">
<input type="submit" name="Run Stocks" value="Run Stocks" style="height:50px" >
<input type="submit" name="Run Crypto" value="Run Crypto" style="height:50px" >
<input type="submit" name="Run Forex" value="Run Forex" style="height:50px" >
<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" >
@ -55,13 +57,7 @@
<input type="submit" value="Set"style="height:30px">
</form>
<p>Display an image</p>
<form action="/DisplayImage" method="POST" enctype=multipart/form-data>
<p><input type=file name=file style="height:30px">
<input type=submit value=Upload style="height:30px">
</form>
<p>Display a gif</p>
<p>Display a image or gif</p>
<form action="/DisplayGIF" method="POST" enctype=multipart/form-data>
<p><input type=file name=file style="height:30px">
<input type=submit value=Upload style="height:30px">