isntall test

This commit is contained in:
Neythen 2021-05-23 10:34:06 +01:00
parent f63756c361
commit 895c091ee6
12 changed files with 113 additions and 79 deletions

View File

@ -192,13 +192,15 @@ if __name__ == '__main__':
NY_time = datetime.now(NY_zone)
print(NY_time)
symbols, stock_info = readCSV('csv/tickers.csv', max_stocks)
updateStockPrices(symbols)
updateUpdate(NY_time)
while True:
coins, coin_info = readCSV('csv/crypto.csv', max_stocks)
updateCrypto(coins)
#updateNews()
updateNews()
NY_time = datetime.now(NY_zone)
symbols, stock_info = readCSV('csv/tickers.csv', max_stocks)

View File

@ -1,3 +1,3 @@
name,current,24hr change
bitcoin,41158,-3.112342608605254
ethereum,2691.26,-8.560574933024819
bitcoin,34484,-6.042010140586837
ethereum,2038.77,-12.44588779457297

1 name current 24hr change
2 bitcoin 41158 34484 -3.112342608605254 -6.042010140586837
3 ethereum 2691.26 2038.77 -8.560574933024819 -12.44588779457297

View File

@ -1 +1 @@
21/05/2021 09:21:44
23/05/2021 05:14:57

1 21/05/2021 09:21:44 23/05/2021 05:14:57

View File

@ -1,21 +1,21 @@
headline, ' doesnt display, sort out comma
Total of 43 Changi Airport workers test positive for Covid-19; source likely worker who helped infected family from South Asia - The Straits Times
Covid-19 (May 21) - 6493 new cases, nationwide uptrend; 50 deaths - Malaysiakini
Lady Gaga says rape as teenager left her pregnant and caused psychotic break - The Guardian
Coronavirus: Spain to lift restrictions for UK and Japanese travellers - BBC News
Walsh wonderful as Warriors win thriller over Tigers - NRL.COM
Diana interview: Whistleblower wants apology from BBC bosses - BBC News
Latest Gombak death-in-custody due to heart attack, says S'gor CPO - Malaysiakini
Prince Harry tells Oprah that Diana's death led him to drink and drugs, accuses royals of 'total neglect' - NBC News
Manchester United passed on signing Man City star Ruben Dias - Manchester Evening News
Prince Harry: pain of Diana's death pushed me to drink and drugs - The Star Online
Kim Kardashian Accused Kourtney Kardashian Of Constantly "Degrading" Her Staff After A Brutal Confrontation With Her Nanny - BuzzFeed News
Overwatch 2 PvP is 5v5, Bastion reworked "from the ground up" - Eurogamer.net
Hospital staff 'should have checked for blood clots', say SA family - 9News
Cloudy skies to continue in Southern Luzon, Visayas and Mindanao due to ITCZ - INQUIRER.net
16-year-old Pune boy merges 50,000 images of Moon to create detailed picture - The Tribune
UK to offer Australia tariff-free trade deal despite farmers' fears - BBC News
Disha Patani does backflip to new BTS song Butter and Tiger Shroff is impressed, watch - Hindustan Times
Mop-up operations begin in Cape Town after flooding caused by heavy rain - News24
New type of coronavirus originating in dogs found — study - The Edge Markets MY
House panel OKs bill for creation of PH virology institute, CDC - ABS-CBN News
headline
CBSE 12th Board Exams, JEE Main, NEET 2021 LIVE Updates: Meeting Concludes, Decision to be Out Shortly - News18
Full Flower Moon and lunar eclipse coming May 26 - Barriere Star Journal
BBC reporter never wanted to harm Diana - Herald Sun
Mad man to bad man: Jared Harris on his winning TV streak - The Guardian
India battles fatal black fungus threat as coronavirus deaths approach 300,000 - Irish Examiner
I wasnt going to embarrass him: Waynes blunt answer to Benji question - Fox Sports
China's Mars rover starts roaming the Red Planet - Jakarta Post
YouTube Confirms BTS's “Butter” MV Has Officially Broken All-Time Record For Most Views In 24 Hours - soompi
Ireland weather forecast as Met Eireann predicts rollercoaster Sunday but big midweek change ahead - Irish Mirror
Covid: Pfizer and AstraZeneca jabs effective against Indian variant - study - BBC News
Delhi Lockdown Extended Again, Arvind Kejriwal Says "May Unlock If..." - NDTV
Rapper AKA gives his version of events leading up to death of fiancé Anele Tembe - News24
China says Martian rover takes first drive on surface of Red Planet - TimesLIVE
300 unvaccinated COVID-19 cases in current outbreak vs 78 vaccinated: Ong Ye Kung - CNA
Cant allow that: Sneaky AFL star getting away with murder - NEWS.com.au
Millions of Brits unwittingly tracked by phone after Covid jab to see if movements changed... - The Sun
India struggles with black fungus infection as Covid deaths surge to 300,000 - The Irish Times
PM Modi holds meeting on Cyclone Yaas, landfall expected on May 26 - Hindustan Times
Australia Talks, one of the nation's biggest social surveys, is back for 2021. Here's how it works - ABC News
Bangladesh vs Sri Lanka, 1st ODI in Dhaka: Live Cricket Score and Updates - India Today

Can't render this file because it contains an unexpected character in line 12 and column 53.

View File

@ -1 +1 @@
ARUSHI IS CUTE,0,0,255
hello world!,255,255,0
1 ARUSHI IS CUTE hello world! 255 0 255 0

View File

@ -1,22 +1,22 @@
name,current,opening
MSFT,246.48,243.96
NFLX,501.67,489.55
GOOG,2356.09,2328.04
TSLA,586.78,575
AAPL,127.31,125.23
INTC,55.95,55.57
TXN,185.3,182.28
HPQ,32.04,31.98
HOG,48.28,48.99
LUV,59.92,60.92
WMT,142.42,141.5
BJ,46.16,48.26
ETSY,172.36,166.28
G,44.26,43.83
GDDY,81.4,81.18
GNRC,308.53,304.56
PEP,147.23,145.25
STM,36.18,35.79
YELP,38.38,37.84
XRAY,67.95,67.72
ZTS,175.8,171.52
MSFT,245.17,247.565
NFLX,497.89,503.12
GOOG,2345.1,2365.99
TSLA,580.88,596.11
AAPL,125.43,127.82
INTC,56.08,56.42
TXN,185.01,186.69
HPQ,31.66,32.26
HOG,48.06,48.68
LUV,60.09,60.26
WMT,141.75,142.52
BJ,45.67,46.26
ETSY,167.56,173
G,44.12,44.3
GDDY,79.08,81.3
GNRC,308.68,311.12
PEP,147.1,147.8734
STM,36.21,36.41
YELP,37.92,38.3
XRAY,67.48,68.01
ZTS,176.02,176.55

1 name current opening
2 MSFT 246.48 245.17 243.96 247.565
3 NFLX 501.67 497.89 489.55 503.12
4 GOOG 2356.09 2345.1 2328.04 2365.99
5 TSLA 586.78 580.88 575 596.11
6 AAPL 127.31 125.43 125.23 127.82
7 INTC 55.95 56.08 55.57 56.42
8 TXN 185.3 185.01 182.28 186.69
9 HPQ 32.04 31.66 31.98 32.26
10 HOG 48.28 48.06 48.99 48.68
11 LUV 59.92 60.09 60.92 60.26
12 WMT 142.42 141.75 141.5 142.52
13 BJ 46.16 45.67 48.26 46.26
14 ETSY 172.36 167.56 166.28 173
15 G 44.26 44.12 43.83 44.3
16 GDDY 81.4 79.08 81.18 81.3
17 GNRC 308.53 308.68 304.56 311.12
18 PEP 147.23 147.1 145.25 147.8734
19 STM 36.18 36.21 35.79 36.41
20 YELP 38.38 37.92 37.84 38.3
21 XRAY 67.95 67.48 67.72 68.01
22 ZTS 175.8 176.02 171.52 176.55

BIN
display_gif Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

After

Width:  |  Height:  |  Size: 747 B

BIN
display_image Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
final.ppm

Binary file not shown.

Binary file not shown.

View File

@ -87,8 +87,7 @@ class StockTicker():
self.matrix.SetPixel(x + offset_x, y + offset_y, r*self.brightness, g*self.brightness, b*self.brightness)
def scrollImage(self, image_file, offset_x = 0, offset_y = 0):
image = self.openImage(image_file)
def scrollImage(self, image, offset_x = 0, offset_y = 0):
img_width, img_height = image.size
@ -112,6 +111,32 @@ class StockTicker():
time.sleep(self.delay)
return False
def scrollImageStacked(self, image, offset_x = 0, offset_y = 0):
img_width, img_height = image.size
while offset_x > -img_width - 128:
offset_x -= 1
self.setImage(image, offset_x = offset_x+128, offset_y = offset_y)
self.setImage(image, offset_x = offset_x, offset_y = offset_y+16)
try:
msg = getInput()
if msg == 'K':
self.resetMatrix()
return True
self.process_msg(msg)
except KeyboardInterrupt:
sys.stdout.flush()
pass
time.sleep(self.delay)
return False
def scrollImageTransition(self, image_files, offset_x = 0, offset_y = 0, stocks = True):
# use two image files and switch between them with a seemless transition
@ -177,9 +202,26 @@ class StockTicker():
elif current_img == 2:
current_img = 1
offset_x = 0
def displayTextRepeating(self):
def textImage(self, text, font, r = 255, g = 255, b = 255):
'''
creates and returns a ppm image containing the text in the supplied font and colour
'''
width, height = self.get_text_dimensions(text, font)
print(text)
print('dims:', width, height)
img = Image.new('RGB', (width + 50, height))
d = ImageDraw.Draw(img)
d.text((4, 0), text, fill=(r, g, b), font=font)
return img
def displayUserText(self):
'''
displays the text entered in the webpage by the user.
'''
f = open('csv/scroll_text.csv', 'r')
@ -191,32 +233,16 @@ class StockTicker():
font = ImageFont.load("./fonts/texgyre-27.pil")
width, height = self.get_text_dimensions(text, font)
print(text)
print('dims:', width, height)
img = Image.new('RGB', (width + 50, 32))
d = ImageDraw.Draw(img)
d.text((4, 0), text, fill=(int(r), int(g), int(b)), font=font)
img = self.textImage(text, font, int(r), int(g), int(b))
img.save('scroll_text.ppm')
self.scrollImageTransition(['scroll_text.ppm', 'scroll_text.ppm'], offset_x = 128, offset_y = 0, stocks = False)
def displayText(self, text, font):
width, height = self.get_text_dimensions(text, font)
print(text)
print('dims:', width, height)
img = Image.new('RGB', (width + 50, 32))
d = ImageDraw.Draw(img)
d.text((4, 0), text, fill=(255, 255, 255), font=font)
img.save('scroll_text.ppm')
return self.scrollImage('scroll_text.ppm', offset_x = 128, offset_y = 0)
def displayNews(self):
font = ImageFont.load("./fonts/8x13.pil")
@ -230,12 +256,16 @@ class StockTicker():
f.close()
for headline in headlines:
killed = self.displayText(headline, font)
img = self.textImage(headline, font)
if killed:
kill = True
if kill: break
if kill: break
#killed = self.scrollImage(img, offset_x = 128, offset_y = 0)
killed = self.scrollImageStacked(img, offset_x = 128, offset_y = 0)
if killed: break
if killed: break
@ -527,7 +557,7 @@ class StockTicker():
elif msg == 'T':# text
self.displayTextRepeating()
self.displayUserText()
elif msg == 'I': # image
@ -547,8 +577,10 @@ if __name__ == '__main__':
#print(sys.stdin.readlines())
stock_ticker = StockTicker()
#stock_ticker.displayTextRepeating()
#stock_ticker.process_msg('f')
#stock_ticker.displayNews()
stock_ticker.displayNews()
#stock_ticker.displayGIF('/home/pi/Desktop/stock_ticker/gifs/open.gif')
#stock_ticker.displayGIF('/home/pi/Desktop/stock_ticker/gifs/close.gif')