Skip to content

Fix crash when no data available for a given category and added a quotes file and a blacklist file. #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
19 changes: 14 additions & 5 deletions bcbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT

quotes_file = open('quotes.txt', 'r')
blacklist_file = open('data_blacklist.txt', 'r')

blacklist = blacklist_file.readlines()

while(1):

Expand All @@ -30,19 +34,24 @@
disp = [0]*38 #38 is the length of the list data
for x in range(len(data)):
if x % 2 == 0:
disp.append(data[x])
if data[x+1] == None:
if data[x+1] != None and data[x]+'\n' not in blacklist:
disp.append(data[x])
disp.append(data[x+1])
else:
disp.append((data[x+1]).replace(',','')) #Each element of disp is the Name of the parameter & its value. The commas present in the values have been removed for better displaying asthetics


disp = list(filter(lambda a:a != 0, disp)) #For some reason every odd element of the list 'disp' is '0'. This removes all occurences of '0' from the list 'disp'

#Remove 'list' in Python2.7
new_quote = quotes_file.readline()
if new_quote == '':
quotes_file = open('quotes.txt', 'r')
new_quote = quotes_file.readline()


disp.insert(0, new_quote)

serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=4 , block_orientation=-90, rotate=2)
device = max7219(serial, cascaded=8 , block_orientation=-90, rotate=2)

for i in range(len(disp)):
show_message(device, disp[i], fill="white", font=proportional(LCD_FONT),scroll_delay = 0.02) #Change the value of 'scroll_delay' to change the Scrolling Speed
Expand Down
2 changes: 2 additions & 0 deletions data_blacklist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bitcoin inflation rate per annum at next block halving event:
Approximate block generation time:
23 changes: 23 additions & 0 deletions quotes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"The computer can be used as a tool to liberate and protect people, rather than to control them." - Hal Finney
"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks." - Bitcoin Blockchain
"I think that the Internet is going to be one of the major forces for reducing the role of government." - Milton Friedman
"A blockchain is a chain of blocks." Peter Todd
"Bitcoin is the currency of resistance." - Max Keiser
"The Federal Reserve simply does not have authority to supervise or regulate Bitcoin in any way..." - Janet Yellen
"A value is valuable when the value of value is valuable to oneself." - Dayananda Saraswati
"If you don't believe it or don't get it, I don't have the time to try to convince you, sorry." - Satoshi Nakamoto
"In retrospect, it was inevitable" - Elon Musk
"So bitcoin is cyber snob currency" - William Shatner
"Bitcoin is the currency of resistance" - Max Keiser
"Cryptocurrency is such a powerful concept that it can almost overturn governments" - Charles Lee
"Bitcoin will do to banks what email did to the postal industry" - Rick Falkvinge
"You can't stop things like Bitcoin. It will be everywhere and the world will have to readjust. World governments will have to readjust" - John McAfee
"The swarm is headed towards us" - Satoshi Nakamoto, when WikiLeaks started accepting Bitcoin donation
"There are 3 eras of currency: Commodity based, politically based, and now, math based" - Chris Dixon
"Don't care" - Honey Badger
"Bitcoin may be the TCP/IP of money" - Paul Buchheit
"Bitcoin actually has the balance and incentives center, and that is why it is starting to take off" - Julian Assange
"Bitcoin is the beginning of something great: a currency without a government, something necessary and imperative" - Nassim Taleb
"I think the internet is going to be one of the major forces for reducing the role of government. The one thing that's missing but that will soon be developed, is a reliable e-cash" - Milton Friedman
"It's money 2.0, a huge huge huge deal" - Chamath Palihapitiya
"Bitcoin is the most important invention in the history of the world since the Internet." - Roger Ver