bug fixes

This commit is contained in:
Neythen 2021-07-15 19:49:53 +01:00
parent c490a5390c
commit 2e4f4dc386
19 changed files with 100 additions and 56 deletions

View File

@ -1,4 +1,4 @@
symbol,name,base,current,24hr change
BTC,bitcoin,usd,32927,0.1348056422318777
ETH,ethereum,gbp,1447.6,0.44060897841839514
DOGE,dogecoin,usd,0.202152,0.7090173677844843
BTC,bitcoin,usd,31554,-4.613357050355953
ETH,ethereum,gbp,1389.61,-4.851321076226648
DOGE,dogecoin,usd,0.184145,-8.017861229371038

1 symbol name base current 24hr change
2 BTC bitcoin usd 32927 31554 0.1348056422318777 -4.613357050355953
3 ETH ethereum gbp 1447.6 1389.61 0.44060897841839514 -4.851321076226648
4 DOGE dogecoin usd 0.202152 0.184145 0.7090173677844843 -8.017861229371038

View File

@ -1 +1 @@
[{"main_weather": "Clouds", "description": "few clouds", "temp": 29.76, "min_temp": 28.24, "max_temp": 30.39, "feels_like": 36.76, "humidity": 80, "clouds": 14, "wind_speed": 0.45, "wind_direction": 255, "visibility": 10000, "uv": 0, "rain_chance": 0}, {"main_weather": "Clouds", "description": "few clouds", "temp": 23.92, "min_temp": 14.67, "max_temp": 23.92, "feels_like": 24.04, "humidity": 64, "clouds": 20, "wind_speed": 0.89, "wind_direction": 284, "visibility": 10000, "uv": 0.8, "rain_chance": 0}]
[{"main_weather": "Clouds", "description": "scattered clouds", "temp": 29.76, "min_temp": 28.5, "max_temp": 30.61, "feels_like": 36.76, "humidity": 81, "clouds": 31, "wind_speed": 0.45, "wind_direction": 275, "visibility": 10000, "uv": 0, "rain_chance": 0}, {"main_weather": "Clouds", "description": "overcast clouds", "temp": 19.71, "min_temp": 14.35, "max_temp": 21.63, "feels_like": 19.62, "humidity": 72, "clouds": 90, "wind_speed": 5.14, "wind_direction": 360, "visibility": 10000, "uv": 0.36, "rain_chance": 0}]

View File

@ -1 +1 @@
[[{"main_weather": "Rain", "description": "light rain", "min_temp": 28.24, "max_temp": 30.39}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.95, "max_temp": 30.09}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.4, "max_temp": 29.06}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.65, "max_temp": 29.11}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.62, "max_temp": 28.55}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.71, "max_temp": 29.87}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.26, "max_temp": 31.54}, {"main_weather": "Rain", "description": "light rain", "min_temp": 29.41, "max_temp": 31.81}], [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 14.67, "max_temp": 23.92}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 14.59, "max_temp": 22.45}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 12.66, "max_temp": 25.26}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 14.87, "max_temp": 26.39}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 16.48, "max_temp": 28.14}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 18.46, "max_temp": 29.05}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 15.76, "max_temp": 21.21}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 12.81, "max_temp": 22.64}]]
[[{"main_weather": "Rain", "description": "light rain", "min_temp": 28.5, "max_temp": 30.61}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.04, "max_temp": 29.77}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.64, "max_temp": 29.24}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.7, "max_temp": 28.62}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.62, "max_temp": 29.4}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.97, "max_temp": 30.11}, {"main_weather": "Rain", "description": "light rain", "min_temp": 28.69, "max_temp": 31.64}, {"main_weather": "Rain", "description": "light rain", "min_temp": 30.01, "max_temp": 32.67}], [{"main_weather": "Clouds", "description": "broken clouds", "min_temp": 14.35, "max_temp": 21.63}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 12.58, "max_temp": 26.02}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 16.35, "max_temp": 27.43}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 17.91, "max_temp": 27.84}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 17.11, "max_temp": 21.74}, {"main_weather": "Rain", "description": "light rain", "min_temp": 15.75, "max_temp": 21.98}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 12.8, "max_temp": 21.13}, {"main_weather": "Rain", "description": "light rain", "min_temp": 14.45, "max_temp": 15.92}]]

View File

@ -0,0 +1 @@
{"stocks": "15/07/2021 14:46:31", "crypto": "15/07/2021 14:46:34", "news": "15/07/2021 14:09:38", "weather": "15/07/2021 14:09:35", "forex": "14/07/2021 18:58:56", "sports": "15/07/2021 14:09:39"}

View File

@ -1,21 +1,21 @@
headline,source,date,time
Amazon rainforest now emitting more CO2 than it absorbs - The Guardian,The Guardian,2021-07-14,16:40:00Z
MI5 investigated rightwing terror suspect who was 13 years old - The Guardian,The Guardian,2021-07-14,16:26:00Z
Ottawa Public Health adds zero new COVID-19 cases for second day this week - CTV Edmonton,Ctvnews.ca,2021-07-14,16:25:24Z
Award-winning Classic Adventure Games Syberia I & II Are FREE For Keeps On GOG - Geek Culture,Geek Culture,2021-07-14,16:18:59Z
Solar radio signals could be used to monitor melting ice sheets - Phys.org,Phys.Org,2021-07-14,16:11:48Z
Baltimore officer charged with murder after stepson is found hidden in crawlspace - NBC News,NBC News,2021-07-14,16:03:41Z
Today at Apple tutorial videos being added to YouTube - htxt.africa,Htxt.co.za,2021-07-14,16:00:49Z
CRISPR stops coronavirus replication in human cells - Livescience.com,Live Science,2021-07-14,15:54:39Z
Tour de France 2021 Stage 17^ as it happened: Tadej Pogacar tightens GC grip after Carapaz bluff - Eurosport UK,Eurosport.co.uk,2021-07-14,15:52:00Z
Catt Sadler gets COVID despite being fully vaccinated: 'Delta is relentless' - Page Six,Page Six,2021-07-14,15:51:00Z
COVID-19 in B.C.: Another update on cases^ deaths^ outbreaks coming from health ministry - CTV News Vancouver,Ctvnews.ca,2021-07-14,15:50:48Z
UK records 42^000 Covid cases in worst day for six months - with 49 more deaths - The Mirror,Mirror Online,2021-07-14,15:46:49Z
EU unveils ambitious climate package as it cools on fossil fuels - CNN ,CNN,2021-07-14,15:45:00Z
COVID-19: UNILAG shuts hostels indefinitely^ reverts to virtual classes - Guardian,Guardian Nigeria,2021-07-14,15:43:00Z
Worten tem stock da Xbox Series X e oferece 3 meses de Xbox Game Pass - Eurogamer.pt,Eurogamer.pt,2021-07-14,15:41:00Z
Bolsonaro in hospital as hiccups persist for more than 10 days - The Guardian,The Guardian,2021-07-14,15:39:00Z
EIA Inventory Report Sends Oil Prices Higher - OilPrice.com,OilPrice.com,2021-07-14,15:33:00Z
Dani Dyer's boyfriend Sammy Kimmence jailed for scamming pensioners out of almost £34^000 - Sky News,Sky.com,2021-07-14,15:31:18Z
Aussie comedian claims his simple maths accurately calculates daily NSW Covid-19 cases - NEWS.com.au,News.com.au,2021-07-14,15:29:31Z
Investment in space companies hit record $4.5 billion in the second quarter^ report says - CNBC,CNBC,2021-07-14,15:27:33Z
Asus ROG Zephyrus S17 (2021) Review - PCMag,PCMag.com,2021-07-15,16:21:43Z
Covid-19: 994 cases reported in State with HSE on higher alert due to rising numbers of infections - The Irish Times,The Irish Times,2021-07-15,16:18:45Z
'We have never seen such a disaster': Dozens dead after heavy flooding in Europe - Stuff.co.nz,Stuff.co.nz,2021-07-15,16:18:00Z
China Criticized the Afghan War. Now It Worries About the Withdrawal. - The New York Times,New York Times,2021-07-15,16:16:00Z
Bukayo Saka: England winger won't allow negativity to break him after Euro 2020 final disappointment - Sky Sports,Sky Sports,2021-07-15,16:14:04Z
Isolation facilities ready for Delta variant DoH - The Manila Times,The Manila Times,2021-07-15,16:12:18Z
Plant-based diet rich in soy reduces troubling menopause symptoms by 84% - News-Medical.Net,News-Medical.Net,2021-07-15,16:07:00Z
UK plan for Troubles amnesty breaches international obligations Irish minister - The Guardian,The Guardian,2021-07-15,16:00:00Z
Calamba local exec survives ambush try - GMA News Online,GMA News,2021-07-15,15:59:04Z
Darts icon and former world champion Andy Fordham dies^ aged 59 - Daily Mail,Daily Mail,2021-07-15,15:57:53Z
Britney Spears' former attorney says change in conservatorship case is imminent: 'We're going to see lawsuits' - Fox News,Fox News,2021-07-15,15:43:58Z
Young YOU | What's happening with the Hubble telescope | You - News24,News24,2021-07-15,15:42:51Z
Engineers find imaging technique could become treatment for deep vein thrombosis - EurekAlert,EurekAlert,2021-07-15,15:41:04Z
Top 10 Covid updates: Third wave likely by end of August^ but numbers may not be high^ says ICMR - Scroll.in,Scroll.in,2021-07-15,15:41:00Z
Brookfield revises hostile bid for Inter Pipeline after losing court challenge^ raises cash price - The Globe and Mail,The Globe And Mail,2021-07-15,15:36:47Z
Britain records 63 Covid deaths in highest daily toll since MARCH - Daily Mail,Daily Mail,2021-07-15,15:32:17Z
Hailey Bieber Shut Down The “Beyond False” Accusations That Justin Bieber “Aggressively Yelled” At Her In A Viral TikTok - BuzzFeed News,BuzzFeed News,2021-07-15,15:31:00Z
Leaked Kremlin documents suggest Vladimir Putin personally authorised operation to help Donald Trump win in 2016 - NEWS.com.au,News.com.au,2021-07-15,15:27:48Z
Dutch crime reporter Peter de Vries dies after being shot in the head - Telegraph.co.uk,Telegraph.co.uk,2021-07-15,15:25:00Z
GTA Online update reveals "gigantic" shared social space to show off your cars - Eurogamer.net,Eurogamer.net,2021-07-15,15:25:00Z

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

View File

@ -1,4 +1,4 @@
name,current,opening
MSFT,282.56,282.41
NFLX,551.69,541.99
GOOG,2646.92,2637.49
MSFT,280.31,282.16
NFLX,540.37,554.86
GOOG,2620.4,2647.615

1 name current opening
2 MSFT 282.56 280.31 282.41 282.16
3 NFLX 551.69 540.37 541.99 554.86
4 GOOG 2646.92 2620.4 2637.49 2647.615

Binary file not shown.

Binary file not shown.

BIN
display_images/display_gif.gif Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
display_images/display_gif.ppm Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 0 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
display_images/user_gif.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 821 B

View File

@ -198,7 +198,7 @@ def DisplayGIF():
return hello()
if fle:
filename = 'user_gif.ppm'
filename = 'user_gif.gif'
fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('display_images', filename)))
global LastCommand
LastCommand = 'Add a new logo file'
@ -207,6 +207,28 @@ def DisplayGIF():
return hello()
return hello()
@app.route("/DisplayImage", methods=['POST'])
def DisplayImage():
if request.method == 'POST':
if 'file' not in request.files:
print('No file attached in request')
return hello()
fle = request.files['file']
if fle.filename == '':
print('No file selected')
return hello()
if fle:
filename = 'user_image.ppm'
fle.save(os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('display_images', filename)))
global LastCommand
LastCommand = 'Add a new logo file'
ticker.sendline('K')
ticker.sendline('I')
return hello()
return hello()
@app.route("/Ticker", methods=['POST'])
def Ticker():

View File

@ -149,8 +149,10 @@ class StockTicker():
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
current_img = 1
image1 = self.openImage(image_files[0])
image2 = self.openImage(image_files[1])
image1 = self.openImage(image_files[0]).convert('RGB')
image2 = self.openImage(image_files[1]).convert('RGB')
double_buffer = self.matrix.CreateFrameCanvas()
kill = False
while True:
@ -159,8 +161,8 @@ class StockTicker():
if stocks:
update_process = Process(target = self.getFullStockImage, args = (1,))
update_process.start()
image1 = self.openImage(image_files[0])
image2 = self.openImage(image_files[1])
image1 = self.openImage(image_files[0]).convert('RGB')
image2 = self.openImage(image_files[1]).convert('RGB')
elif current_img == 2:
@ -168,8 +170,8 @@ class StockTicker():
update_process = Process(target = self.getFullStockImage, args = (2,))
update_process.start()
image1 = self.openImage(image_files[1])
image2 = self.openImage(image_files[0])
image1 = self.openImage(image_files[1]).convert('RGB')
image2 = self.openImage(image_files[0]).convert('RGB')
img_width, img_height = image1.size
@ -177,11 +179,13 @@ class StockTicker():
while offset_x > -img_width:
offset_x -= 1
self.setImage(image1, offset_x = offset_x, offset_y = offset_y)
double_buffer.SetImage(image1, offset_x, offset_y)
if offset_x + img_width < self.matrix.width: # if the image is ending
self.setImage(image2, offset_x = offset_x + img_width, offset_y = offset_y)
double_buffer.SetImage(image2, offset_x, offset_y)
double_buffer = self.matrix.SwapOnVSync(double_buffer)
time.sleep(self.delay)
kill = self.checkKilled()
@ -206,10 +210,11 @@ class StockTicker():
for option in options:
if option not in ['display_gif']:
if option not in ['display_gif']: # aving the gif like this kills the animation
img = self.functions[option]()
img.save('./display_images/'+ option+ '.ppm')
def checkKilled(self):
kill = False
@ -239,9 +244,12 @@ class StockTicker():
update_process = Process(target = self.updateMultiple, args = ([options[(i+1) % len(options)]],))
update_process.start()
image = self.openImage('./display_images/' + options[i % len(options)] +'.ppm')
if options[i % len(options)] != 'display_gif':
image = self.openImage('./display_images/' + options[i % len(options)] +'.ppm')
image = image.convert('RGB')
else:
image = self.openImage('./display_images/user_gif.gif')
img_width, img_height = image.size
@ -352,7 +360,7 @@ class StockTicker():
if kill: break
if kill: break
while pause_frames > 0:
if pause_frames%frames == 0:
@ -378,31 +386,34 @@ class StockTicker():
kill = self.checkKilled()
if kill: break
if kill: break
while offset_x > -img_width:
# for animation in gifs
if offset_x%frames == 0:
try:
try:
print(frame)
image.seek(frame)
except EOFError:
frame = 0
image.seek(frame)
frame +=1
#image = image.convert('RGB')
offset_x -= 1
#self.setImage(image.convert('RGB'), offset_x = offset_x, offset_y = offset_y)
if options[i % len(options)] != 'display_gif':
double_buffer.SetImage(image, offset_x, offset_y)
else:
double_buffer.SetImage(image.convert('RGB'), offset_x, offset_y)
@ -1238,7 +1249,7 @@ class StockTicker():
title_img = self.openImage('feature_titles/weather.png')
imgs = [title_img]
imgs = [title_img, self.blank]
current_weathers = json.load(open('csv/current_weather.json', 'r'))
for i, location in enumerate(locations):
img = Image.new('RGB', (200, 32))
@ -1265,15 +1276,15 @@ class StockTicker():
img.paste(weather_img, (5,9))
temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font)
img.paste(temp_img, (36,9))
img.paste(temp_img, (39,9))
deg_img = self.textImage('o', small_font)
img.paste(deg_img, (56, 8))
img.paste(deg_img, (59, 8))
main = current_weather['main_weather']
main_img = self.textImage(main.upper(), small_font)
img.paste(main_img, (34, 26))
img.paste(main_img, (35, 26))
feels_img = self.textImage('Feels like:'.upper() + str("{0:.0f}".format(current_weather['feels_like'])), small_font)
img.paste(feels_img, (location_img.size[0] + 10, 0))
@ -1335,7 +1346,7 @@ class StockTicker():
img.paste(vtext_img, (168, 22))
imgs.append(img)
imgs.append(self.blank)
return self.stitchImage(imgs)
@ -1599,7 +1610,7 @@ class StockTicker():
f.close()
title_img = self.openImage('feature_titles/weather.png')
imgs = [title_img]
imgs = [title_img, self.blank]
current_weathers = json.load(open('csv/current_weather.json', 'r'))
@ -1740,6 +1751,7 @@ class StockTicker():
img1 = img.crop((0,0,x_offset ,32))
imgs.append(img1)
imgs.append(self.blank)
# add the image text
@ -1848,7 +1860,7 @@ class StockTicker():
def getUserGIF(self):
gif = Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/user_gif.ppm'))
gif = Image.open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'display_images/user_gif.gif'))
return gif
def displayStocks(self):
@ -1917,6 +1929,8 @@ class StockTicker():
self.scrollFunctionsAnimated(['display_image', 'display_image'], animation = 'traditional')
elif msg == 'G': # gif
image = self.openImage('./display_images/user_gif.gif')
#self.displayGIF(image)
self.scrollFunctionsAnimated(['display_gif', 'display_gif'], animation = 'traditional')
elif msg == 'W': # weather
@ -1974,7 +1988,7 @@ if __name__ == '__main__':
#
#stock_ticker.process_msg('A')
#stock_ticker.process_msg('G')
#stock_ticker.process_msg('G')
#stock_ticker.process_msg('f')
#stock_ticker.process_msg('W')

View File

@ -58,12 +58,19 @@
<input type="submit" value="Set"style="height:30px">
</form>
<p>Display a image or gif</p>
<p>Display a 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">
</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>
<br><br>
<h3>Tickers to display</h3>
<p>To change the tickers displayed please upload a CSV (comma separated value) file with 11 tickers on each row e.g</p>