weather updates
@ -1,3 +1,3 @@
|
||||
symbol,name,base,current,24hr change
|
||||
BTC,bitcoin,usd,36270,11.591900040164834
|
||||
ETH,ethereum,gbp,1829.0,5.008493193662653
|
||||
BTC,bitcoin,usd,36677,1.7630938507292586
|
||||
ETH,ethereum,gbp,1741.46,-3.9475043829295924
|
||||
|
|
@ -1 +1 @@
|
||||
["USD", {"AUD": [1.29, 1.2903], "CAD": [1.2078, 1.2072], "CHF": [0.89487, 0.89591], "EUR": [0.82001, 0.82088], "GBP": [0.70564, 0.70678], "JPY": [109.37, 109.41], "NZD": [1.3879, 1.3861]}]
|
||||
["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]}]
|
@ -1 +1 @@
|
||||
{"main_weather": "Clouds", "description": "scattered clouds", "temp": 27.71, "min_temp": 26.64, "max_temp": 28.51, "feels_like": 32.84, "humidity": 90, "clouds": 34, "wind_speed": 1.79, "wind_direction": 90, "visibility": 10000, "uv": 0, "rain_chance": 0.41}
|
||||
{"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": 1.34, "wind_direction": 52, "visibility": 10000, "uv": 0, "rain_chance": 0.2}
|
@ -1 +1 @@
|
||||
[{"main_weather": "Rain", "description": "light rain", "min_temp": 27.45, "max_temp": 29.43}, {"main_weather": "Rain", "description": "light rain", "min_temp": 27.12, "max_temp": 29.24}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.26, "max_temp": 29.02}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.42, "max_temp": 28.3}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.69, "max_temp": 28.6}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.04, "max_temp": 29.2}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 27.96, "max_temp": 28.81}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 28.06, "max_temp": 30.03}]
|
||||
[{"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}]
|
@ -1 +1 @@
|
||||
09/06/2021 14:38:44
|
||||
10/06/2021 14:53:37
|
||||
|
|
40
csv/news.csv
@ -1,21 +1,21 @@
|
||||
headline,source,date,time
|
||||
COVID-19: UK daily cases highest since February - as PM insists 'freedom day' call will be driven by data - Sky News,Sky.com,2021-06-09,16:29:41Z
|
||||
Trump’s TikTok^ WeChat Actions Targeting China Revoked by Biden - The Wall Street Journal,The Wall Street Journal,2021-06-09,16:29:00Z
|
||||
Corals' natural 'sunscreen' may help them weather climate change - Phys.org,Phys.Org,2021-06-09,16:26:34Z
|
||||
EU takes legal action against Germany after tussle between courts - The Guardian,The Guardian,2021-06-09,16:26:00Z
|
||||
New WhatsApp feature won’t be allowed on iPhones or iPads - only Android phones - The Independent,Independent,2021-06-09,16:25:09Z
|
||||
Ontario education minister reveals details of new Grade 9 math curriculum - CBC.ca,CBC News,2021-06-09,16:24:29Z
|
||||
Manitoba to give $2M in prizes to people who get vaccinated - CBC.ca,CBC News,2021-06-09,16:18:16Z
|
||||
Scientists find hundreds of examples of mysterious radio blasts coming from deep in the universe - The Independent,Independent,2021-06-09,16:16:24Z
|
||||
G7 summit 2021 live: Biden flies into UK for meeting of world leaders^ as EU losing patience over Brexit deal - The Independent,Independent,2021-06-09,16:13:59Z
|
||||
Donald Trump-era ban on TikTok dropped by Joe Biden - BBC News,BBC News,2021-06-09,16:10:56Z
|
||||
Enoch Mpianzi: Parktown Boys' High principal reinstated^ will be paid for the six months he hadn't worked - News24,News24,2021-06-09,16:07:09Z
|
||||
Russian court expected to outlaw Alexei Navalny’s organisation - The Guardian,The Guardian,2021-06-09,16:04:00Z
|
||||
Another 4^700 new COVID-19 vaccines given in Wellington-Dufferin-Guelph - Global News,Global News,2021-06-09,16:02:47Z
|
||||
Biden holds ‘very deep’ concerns on Brexit and Northern Ireland as he jets to UK - TheJournal.ie,TheJournal.ie,2021-06-09,16:00:00Z
|
||||
Teens and adults miss 26 million doses of CDC-recommended vaccines during the COVID-19 pandemic^ study finds - Yahoo News,USA Today,2021-06-09,15:58:49Z
|
||||
Bata Q4 results: Net profit falls 23% to 29 cr^ announces dividend of ₹4/share - Mint,Livemint,2021-06-09,15:57:20Z
|
||||
Gap to close 19 UK and Ireland stores after £740m loss during Covid pandemic - The Independent,Independent,2021-06-09,15:47:59Z
|
||||
Record-breaking Aussie dinosaur was as long as a basketball court - Livescience.com,Live Science,2021-06-09,15:44:23Z
|
||||
Australutean. Paleontologists have identified one of the largest dinosaurs in the world - Pakistan Christian TV,Pakistanchristian.tv,2021-06-09,15:41:15Z
|
||||
Google kills its augmented reality “Measure” app - Ars Technica,Ars Technica,2021-06-09,15:36:49Z
|
||||
Hackers break into EA^ steal source code for 'FIFA 21' -Vice - CNA,CNA,2021-06-10,16:39:20Z
|
||||
Coronavirus in Indiana: 374 New COVID Cases^ 2 Additional Deaths^ 21K Vaccinations - NBC Chicago,NBC Chicago,2021-06-10,16:30:44Z
|
||||
'Ring of fire' solar eclipse thrills northern hemisphere - Stuff.co.nz,Stuff.co.nz,2021-06-10,16:27:00Z
|
||||
Exercise likely to be best treatment for depression in coronary heart disease - IOL,IOL,2021-06-10,16:26:21Z
|
||||
LG OLED TV and Dolby creates true cinematic experience - The Manila Times,The Manila Times,2021-06-10,16:25:09Z
|
||||
‘Grim milestone' with record five million people now waiting for NHS hospital treatment - Telegraph.co.uk,Telegraph.co.uk,2021-06-10,16:20:00Z
|
||||
Green MP Jenica Atwin crossing the floor to join the Liberals - CBC.ca,CBC News,2021-06-10,16:13:28Z
|
||||
Wife of drug kingpin 'El Chapo' pleads guilty to US charges - Associated Press,Associated Press,2021-06-10,16:10:17Z
|
||||
Stunning photos of the solar eclipse captured in parts of Canada - CTV News,Ctvnews.ca,2021-06-10,16:09:00Z
|
||||
'CryptoPunk' NFT sells for US$11.8 million: Sotheby's - CNA,CNA,2021-06-10,16:02:46Z
|
||||
Partial eclipse sweeps over northern hemisphere - ABS-CBN News,Abs-cbn.com,2021-06-10,16:02:00Z
|
||||
ESA flying payloads on wooden satellite - Phys.org,Phys.Org,2021-06-10,16:00:01Z
|
||||
64pc of Covid-19 cases in the last two weeks were in under-35 age group - Independent.ie,Independent.ie,2021-06-10,16:00:00Z
|
||||
COVID-19: Delta coronavirus variant now makes up 91% of new UK infections - as cases rise 'rapidly' - Sky News,Sky.com,2021-06-10,15:59:16Z
|
||||
Macron slap: Four months for man who attacked French president - BBC News,BBC News,2021-06-10,15:57:40Z
|
||||
Macron slap: Four months for man who attacked French president - BBC News,BBC News,2021-06-10,15:57:40Z
|
||||
QC prosecutor indicts editor^ reporter for libel over story on Catriona Gray's fake nude photos - GMA News,GMA News,2021-06-10,15:57:38Z
|
||||
Major breakthrough for private power providers as Ramaphosa makes big move - News24,News24,2021-06-10,15:35:51Z
|
||||
'Wake-up call for Canada': Security experts say case of 2 fired scientists could point to espionage - CBC.ca,CBC News,2021-06-10,15:31:17Z
|
||||
Ngee Ann Poly lecturer involved in racist remark incident made Islamophobic comments in class^ says ex-student - The Straits Times,The Straits Times,2021-06-10,15:28:12Z
|
||||
|
|
@ -1,4 +1,4 @@
|
||||
name,current,opening
|
||||
MSFT,254.405,253.81
|
||||
NFLX,489.885,494.5
|
||||
GOOG,2492.03,2499.5
|
||||
MSFT,256.64,254.29
|
||||
NFLX,487.55,487.165
|
||||
GOOG,2508.01,2494.01
|
||||
|
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
218
stockTicker.py
@ -564,7 +564,7 @@ class StockTicker():
|
||||
logo = Image.open(os.path.join(logos_path, currency.lower() + '.png'))
|
||||
bse = Image.open(os.path.join(logos_path, base.lower() + '.png'))
|
||||
|
||||
new_im = Image.new('RGB', (42, 32))
|
||||
new_im = Image.new('RGB', (32, 32))
|
||||
|
||||
for im in image_list:
|
||||
|
||||
@ -620,10 +620,10 @@ class StockTicker():
|
||||
weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png')
|
||||
img.paste(weather_img, (5,9))
|
||||
|
||||
temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font, r = 200, g = 0, b = 255)
|
||||
temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font)
|
||||
img.paste(temp_img, (50,9))
|
||||
|
||||
deg_img = self.textImage('o', small_font, r = 200, g = 0, b = 255)
|
||||
deg_img = self.textImage('o', small_font)
|
||||
print(temp_img.size)
|
||||
img.paste(deg_img, (70, 8))
|
||||
|
||||
@ -631,14 +631,14 @@ class StockTicker():
|
||||
main_img = self.textImage(main, small_font)
|
||||
img.paste(main_img, (48, 26))
|
||||
|
||||
feels_img = self.textImage('Feels like:' + str("{0:.0f}".format(current_weather['feels_like'])), small_font, r = 200, g = 0, b = 255)
|
||||
img.paste(feels_img, (location_img.size[0] + 5, 0))
|
||||
feels_img = self.textImage('Feels like:' + str("{0:.0f}".format(current_weather['feels_like'])), small_font)
|
||||
img.paste(feels_img, (location_img.size[0] + 10, 0))
|
||||
|
||||
min_img = self.textImage( "{0:.0f}".format(current_weather['min_temp']), small_font, r=0, g=0, b=255)
|
||||
img.paste(min_img, (75, 15))
|
||||
img.paste(min_img, (80, 12))
|
||||
|
||||
max_img = self.textImage( "{0:.0f}".format(current_weather['max_temp']), small_font, r=255, g=0, b=0)
|
||||
img.paste(max_img, (90, 15))
|
||||
img.paste(max_img, (80, 22))
|
||||
|
||||
hum_img = Image.open(weather_dir + '/humidity.png')
|
||||
img.paste(hum_img, ( 107, 8))
|
||||
@ -650,7 +650,7 @@ class StockTicker():
|
||||
img.paste(uv_img, ( 107, 20))
|
||||
|
||||
utext_img = self.textImage(str(current_weather['uv']) , small_font)
|
||||
img.paste(utext_img, (118, 23))
|
||||
img.paste(utext_img, (119, 23))
|
||||
|
||||
weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
months =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||
@ -669,7 +669,7 @@ class StockTicker():
|
||||
img.paste(rain_img, (143,8))
|
||||
|
||||
|
||||
rtext_img = self.textImage(str(current_weather['rain_chance']) + '%', small_font)
|
||||
rtext_img = self.textImage(str(int(current_weather['rain_chance']*100)) + '%', small_font)
|
||||
img.paste(rtext_img, (156, 10))
|
||||
|
||||
cloud_img = Image.open(weather_dir + '/clouds.png')
|
||||
@ -697,7 +697,7 @@ class StockTicker():
|
||||
|
||||
return img
|
||||
|
||||
def getDailyWeatherImage(self):
|
||||
def getDailyWeatherImageAlt(self):
|
||||
|
||||
|
||||
f = open( "csv/weather_location.txt", 'r' )
|
||||
@ -842,6 +842,189 @@ class StockTicker():
|
||||
|
||||
return img0, img1
|
||||
|
||||
|
||||
def getDailyWeatherImage(self):
|
||||
|
||||
|
||||
f = open( "csv/weather_location.txt", 'r' )
|
||||
location = f.read()
|
||||
f.close()
|
||||
img = Image.new('RGB', (1000, 32))
|
||||
|
||||
current_weather = json.load(open('csv/current_weather.json', 'r'))
|
||||
|
||||
small_font = ImageFont.load("./fonts/5x7.pil")
|
||||
extra_small_font = ImageFont.load("./fonts/4x6.pil")
|
||||
large_font = ImageFont.load("./fonts/10x20.pil")
|
||||
|
||||
|
||||
location_img = self.textImage(location, extra_small_font, r = 255, g = 255, b = 0)
|
||||
|
||||
|
||||
|
||||
main = current_weather['main_weather']
|
||||
if main == 'Clouds':
|
||||
main = current_weather['description']
|
||||
weather_ids = {'Clear': '01', 'few clouds': '02', 'scattered clouds': '03', 'broken clouds':'04', 'overcast clouds':'04', 'Drizzle':'09',
|
||||
'Rain':'10', 'Thunderstorm':'11', 'Snow':'13', 'Mist': '50', 'Smoke': '50', 'Haze': '50', 'Dust': '50', 'Fog': '50',
|
||||
'Sand': '50', 'Ash': '50', 'Squall': '50', 'Tornado': '50'}
|
||||
|
||||
weather_dir = './logos/weather_icons'
|
||||
|
||||
weather_img = Image.open(weather_dir + '/weather_type_icons/' + weather_ids[main] + '.png')
|
||||
|
||||
|
||||
temp_img = self.textImage(str("{0:.0f}".format(current_weather['temp'])), large_font)
|
||||
|
||||
|
||||
deg_img = self.textImage('o', small_font)
|
||||
|
||||
min_img = self.textImage( "{0:.0f}".format(current_weather['min_temp']), small_font, r=0, g=0, b=255)
|
||||
|
||||
|
||||
max_img = self.textImage( "{0:.0f}".format(current_weather['max_temp']), small_font, r=255, g=0, b=0)
|
||||
|
||||
|
||||
main = current_weather['main_weather']
|
||||
main_img = self.textImage(main, small_font)
|
||||
|
||||
weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
months =['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||
month = months[int(datetime.now().strftime('%m'))]
|
||||
date = str(int(datetime.now().strftime('%d')))
|
||||
|
||||
weekday = weekdays[datetime.today().weekday()]
|
||||
|
||||
date_img = self.textImage(month + ' ' + date + ',' + weekday, extra_small_font)
|
||||
|
||||
rain_img = Image.open(weather_dir + '/rain-chance.png')
|
||||
|
||||
|
||||
|
||||
rtext_img = self.textImage(str(int(current_weather['rain_chance']*100)) + '%', extra_small_font)
|
||||
|
||||
|
||||
hum_img = Image.open(weather_dir + '/humidity.png')
|
||||
|
||||
|
||||
htext_img = self.textImage(str(current_weather['humidity']) + '%', extra_small_font)
|
||||
|
||||
|
||||
uv_img = Image.open(weather_dir + '/uv.png')
|
||||
|
||||
|
||||
utext_img = self.textImage(str(current_weather['uv']) , extra_small_font)
|
||||
|
||||
wind_img = Image.open(weather_dir + '/wind.png')
|
||||
|
||||
wtext_img = self.textImage(str(current_weather['wind_speed']) + 'm/s', extra_small_font)
|
||||
|
||||
|
||||
|
||||
uv_img = Image.open(weather_dir + '/uv.png')
|
||||
|
||||
|
||||
utext_img = self.textImage(str(current_weather['uv']) , small_font)
|
||||
|
||||
|
||||
cloud_img = Image.open(weather_dir + '/clouds.png')
|
||||
|
||||
|
||||
ctext_img = self.textImage(str(current_weather['clouds']) + '%', small_font)
|
||||
|
||||
|
||||
wind_img = Image.open(weather_dir + '/wind.png')
|
||||
|
||||
|
||||
wtext_img = self.textImage("{0:.0f}".format(current_weather['wind_speed']) + 'm/s', small_font)
|
||||
|
||||
|
||||
wdir_img = self.textImage(self.degreesToCompass(current_weather['wind_direction']), small_font)
|
||||
|
||||
|
||||
vis_img = Image.open(weather_dir + '/visibility.png')
|
||||
|
||||
|
||||
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))
|
||||
img.paste(deg_img, (50, 8))
|
||||
img.paste(min_img, (55, 10))
|
||||
img.paste(main_img, (30, 26))
|
||||
img.paste(max_img, (55, 20))
|
||||
img.paste(date_img, (location_img.size[0], 1))
|
||||
|
||||
|
||||
img.paste(rain_img, (90,0))
|
||||
img.paste(rtext_img, (103, 1))
|
||||
|
||||
img.paste(hum_img, (117, 0))
|
||||
img.paste(htext_img, (128, 1))
|
||||
|
||||
img.paste(uv_img, ( 143, 0))
|
||||
img.paste(utext_img, (156, 1))
|
||||
|
||||
img.paste(cloud_img, (169,0))
|
||||
img.paste(ctext_img, (182, 1))
|
||||
|
||||
img.paste(wind_img, (205,0))
|
||||
img.paste(wtext_img, (218, 1))
|
||||
img.paste(wdir_img, (231, 1))
|
||||
|
||||
img.paste(vis_img, (243,0))
|
||||
img.paste(vtext_img, (256, 1))
|
||||
#img.paste(uv_img, ( 96, 0))
|
||||
#img.paste(utext_img, (109, 0))
|
||||
#img.paste(wind_img, (96,0))
|
||||
#img.paste(wtext_img, (109,0))
|
||||
|
||||
|
||||
daily_weather = json.load(open('csv/daily_weather.json', 'r'))
|
||||
|
||||
#img.paste(date_img, (70, 0))
|
||||
|
||||
|
||||
x_offset = 70
|
||||
|
||||
for i in range(1,len(daily_weather)-1):
|
||||
|
||||
|
||||
weekday = weekdays[(datetime.today().weekday() + i)%7]
|
||||
|
||||
day_img = self.textImage( weekday, small_font)
|
||||
weather = daily_weather[i]
|
||||
main = weather['main_weather']
|
||||
|
||||
|
||||
if main == 'Clouds':
|
||||
main = weather['description']
|
||||
|
||||
weather_img = Image.open(weather_dir + '/small_icons/' + weather_ids[main] + '.png')
|
||||
min_img = self.textImage( "{0:.0f}".format(weather['min_temp']), small_font, r=0, g=0, b=255)
|
||||
|
||||
|
||||
max_img = self.textImage( "{0:.0f}".format(weather['max_temp']), small_font, r=255, g=0, b=0)
|
||||
|
||||
img.paste(day_img, (x_offset +5, 9))
|
||||
img.paste(weather_img, (x_offset +5, 16))
|
||||
img.paste(min_img, (x_offset + 25, 10))
|
||||
img.paste(max_img, (x_offset + 25, 21))
|
||||
|
||||
x_offset += 40
|
||||
|
||||
img1 = img.crop((0,0,x_offset ,32))
|
||||
|
||||
|
||||
|
||||
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")
|
||||
@ -921,8 +1104,8 @@ class StockTicker():
|
||||
self.running = False
|
||||
print('MATRIX DISPLAY STOP CALLED')
|
||||
|
||||
def displayDailyWeather(self):
|
||||
img0, img1 = self.getDailyWeatherImage()
|
||||
def displayDailyWeatherAlt(self):
|
||||
img0, img1 = self.getDailyWeatherImageAlt()
|
||||
#img = stock_ticker.getTodayWeatherImage()
|
||||
|
||||
|
||||
@ -963,6 +1146,9 @@ class StockTicker():
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def process_msg(self, msg):
|
||||
|
||||
if msg == 'S': # stocks
|
||||
@ -1016,7 +1202,13 @@ class StockTicker():
|
||||
self.scrollImageTransition(['weather.ppm', 'weather.ppm'], stocks = False)
|
||||
|
||||
elif msg == 'D': # daily weather
|
||||
self.displayDailyWeather()
|
||||
#self.displayDailyWeatherAlt()
|
||||
|
||||
img = self.getDailyWeatherImage()
|
||||
img.save('weather.ppm')
|
||||
#self.setImage( image)
|
||||
self.scrollImageTransition(['weather.ppm', 'weather.ppm'], stocks = False)
|
||||
|
||||
|
||||
elif msg == 'K': # kill
|
||||
self.resetMatrix()
|
||||
|